Click here to Skip to main content
15,900,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Can anyone advice me whether it is possible to use session in different Namespace in C#, If Yes, kindly let the steps to fallow and achieve this..

Kindly let me know ASAP...

SQL
If I have namespace A,B and when i store session value from an class in Namespace A,
From any class NameSpace B, I want to get the value of that session...
Posted
Updated 7-Feb-11 22:23pm
v2

I don't seem to understand your question correctly (are you talking about sessions in ASP.Net?).
A session is applicable for the entire web page as a whole and is not related to a namespace.
 
Share this answer
 
v2
Comments
sapien4u 8-Feb-11 4:30am    
I agree with this. It is not related to a particular namespace.
Session is 'user' based. It is accessible across the application for a single user.

Session["myData"] = "someData";

Now, access Session["myData"] anywhere in your application(across namespaces too) for the same user.
 
Share this answer
 
Comments
Abhinav S 8-Feb-11 4:22am    
Except for one thing, we dont have sessions in windows forms. :)
Manas Bhardwaj 8-Feb-11 4:26am    
I would rather say Session is User's Session based :). If you access application from different browser (or whatsoever), you won't have that information available.
Sandeep Mewara 8-Feb-11 4:40am    
Agreed.
sapien4u 8-Feb-11 4:31am    
I also agree with this. Session can be accessed anywhere in the web application, for the same user and in the same browser instance.
sathya4260 8-Feb-11 4:33am    
I cant able use session["username"] in different namespace...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900