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

2 comments:

  1. Hi Meetu,
    Thanks for you code, it is working perfectly.

    Ramesh Rana

    ReplyDelete
  2. WoOw GoOd

    by Edison Amirtha Raj.oO

    and send example code. edison3143@gmail.com

    ReplyDelete

Subscribe via email

Enter your email address:

Delivered by FeedBurner

MSDotnetMentor

MSDotnetMentor My Website http://msdotnetmentor.com