Home Articles ASP.Net Using a session variable in class files in c# ASP.Net


Using a session variable in class files in c# ASP.Net

User Rating: / 2
PoorBest 
Avatar

I was working on a project and a requirment 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

Comments (0)
Only registered users can write comments!
Last Updated on Saturday, 13 March 2010 07:30  

Member Login

AddThis Social Bookmark Button