Showing posts with label Use a session variable in the class files in c# ASP.Net. Show all posts
Showing posts with label Use a session variable in the class files in c# ASP.Net. Show all posts

Monday, March 23, 2009

Use a session variable in the class files in c# ASP.Net

To use the value of a session variable in the class files using c# with ASP.Net use the following statement

direct use of Session collection is not allowed in the .cs files so to achieve the purpose we have to follow the whole path i.e

System.Web.HttpContext.Current.Session["varname"].ToString()

Example:
[code]
System.Web.HttpContext.Current.Session["con1"].ToString()
[/code]
++
Thanks and Regards
Meetu Choudhary

Subscribe via email

Enter your email address:

Delivered by FeedBurner

MSDotnetMentor

MSDotnetMentor My Website http://msdotnetmentor.com