Click here to Skip to main content
11,565,382 members (39,115 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi,

I'm using master page in my web application, my problem is, session is null in all content pages. of course session is created by Login page that is using master page.

each Content Page and web.config set properly for enableSessionState =true
but there is no Session enable property in Master Page,

and in Content page IsNewSession Property returns true ???
is it create new session in Content Page ?


any help !! thanks in advance.
Posted 31-Jan-13 20:37pm
Comments
AshishChaudha at 1-Feb-13 3:05am
   
Did not understand your question!! please elaborate your question with some code sample.
Marco Alessandro Bertschi at 1-Feb-13 4:31am
   
Where are you hosting the App?
Sessions do not work if the App is located on a Server farm because they are machine-specific.
hemantrautela at 1-Feb-13 4:31am
   
Didn't getting you properly,

Just add Session in start page (whichever you want as login page)
Session["keyname"]=keyvalue;
and after login you can use anywhere that session.
string var_name = Session["keyname"].toString();
Needn't to enable/disable anywhere...
joe_j at 1-Feb-13 8:17am
   
try adding the session in your content page (login page) and check and provide more details
Kishor Deshpande at 2-Feb-13 6:33am
   
Can you please share details,
Session state mode??
Cookieless?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi All,


I Got the Final Solution, The only reason why HttpContext.Current.Session returning null is because i am set CookieLess =true in web.config , which is default false if i want to access HttpContext.Current.Session from outside the web project.


Thanks
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

check this...
session["username"]=txtusername.text;
otherwisewise
session.add("username")=txtusername.text;
  Permalink  

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

  Print Answers RSS


Advertise | Privacy | Mobile
Web03 | 2.8.150624.2 | Last Updated 12 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100