session in a class

  • Thread starter Thread starter news.microsoft.com
  • Start date Start date
N

news.microsoft.com

I created an asp.net project, and then a new class whitin a file.
How can i access the session of the project within the new class?
If i try
session("var")="user "
I have an error message.

Tanks


Fernando
 
I created an asp.net project, and then a new class whitin a file.
How can i access the session of the project within the new class?
If i try
session("var")="user "
I have an error message.

Tanks


Fernando

Web.HttpContext.Current.Session("FOO")

- Oytun YILMAZ
 
Fully qualify the variable name and use the "Current" property of the
HttpContext.

System.Web.HttpContext.Current.Session["your var"] = "user";

- Paul Glavich

-----Original Message-----
From: news.microsoft.com [mailto:[email protected]]
Posted At: Tuesday, 10 August 2004 9:58 PM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: session in a class
Subject: session in a class


I created an asp.net project, and then a new class whitin a file.
How can i access the session of the project within the new class?
If i try
session("var")="user "
I have an error message.

Tanks


Fernando
 
Hi Fernando:

Look at the Current property of the HttpContext class.

i.e. HttpContext.Current.Session ...

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top