.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

how to get the session value in class file

Posted By: Radhika     Posted Date: February 22, 2013    Points:5   Category :ASP.Net
I have created session variable in .aspx.cs file and would like to get this session value in a class (.cs) file.

How can I get session value in a class file using c#?

Thanks

Responses
Author: Amit Mehra             
Posted Date: February 26, 2013     Points: 20   

hi,

You can get the session object in a class (.cs or .vb) file using HttpContext class's

For example using code

object myObject = HttpContext.Current.Session["YOUR_SESSION_NAME"];


Hope this helps

Thanks,
Amit
Please "Mark As Answer " if this post help you.


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend