Click here to Skip to main content
12,553,313 members (56,565 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET

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
AshishChaudha 1-Feb-13 3:05am
Did not understand your question!! please elaborate your question with some code sample.
Marco Alessandro Bertschi 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 1-Feb-13 4:31am
Didn't getting you properly,

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

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

Solution 2

check this...

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161021.1 | Last Updated 12 Feb 2013
Copyright © CodeProject, 1999-2016
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