Link to home
Start Free TrialLog in
Avatar of sitg
sitgFlag for Iceland

asked on

Context.Session is found null on postback,

hi,

i am doing some work related to session in the Application_AuthenticateRequest even

when the page load , Current.Session object is perfect.

but when i click on submit of the login page and application_authenticateRequest is called.
is shows curent.session object is null.

how can i get the session object which i stored while login.

Thank
ASKER CERTIFIED SOLUTION
Avatar of REA_ANDREW
REA_ANDREW
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I don't think it's possible to access the Session in Application_AuthenticateRequest
Avatar of sitg

ASKER

i mean the same
it is also returning null.
Avatar of sitg

ASKER

HttpContext.Current.Session is returing null
Shouldnt the session get established only AFTER a successfull login??
ahh I have mis read your question sorry.

Use a cookie to persist the data or


Andrew
Application["YourVariable"] = "YourValue";

Open in new window

Avatar of sitg

ASKER

hi,
but i want to store this information only session wise

my requirement is:
on succusfully login i store the iPrinciple object containing the roles in the session and on each request in the  Application_AuthenticateRequest, i want to  get the roles from the session instead of hitting the data store everytime.

but in Application_AuthenticateRequest it is returning "HttpContext.Current.Session" means Session containter itself is null , because my check
" if(HttpContext.Current.Session["aa"]==null) "
is  throwing the exception that "object reference is not set to instance of object"
Avatar of sitg

ASKER

my problem is still there.
no answer is resolving my problem
please help
Again, Session is null and will always be null in Application_AuthenticateRequest, find another way.
Avatar of sitg

ASKER

thanks .