Solved

Context.Session is found null on postback,

Posted on 2007-11-21
10
995 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:sitg
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 20

Accepted Solution

by:
REA_ANDREW earned 500 total points
ID: 20328480
HttpContext.Current.Session["YourSession"] is the fully qualified version.  You missed of the Context

Andrew
0
 
LVL 33

Expert Comment

by:raterus
ID: 20328603
I don't think it's possible to access the Session in Application_AuthenticateRequest
0
 

Author Comment

by:sitg
ID: 20328604
i mean the same
it is also returning null.
0
 

Author Comment

by:sitg
ID: 20328843
HttpContext.Current.Session is returing null
0
 
LVL 21

Expert Comment

by:surajguptha
ID: 20329162
Shouldnt the session get established only AFTER a successfull login??
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 20

Expert Comment

by:REA_ANDREW
ID: 20329512
ahh I have mis read your question sorry.

Use a cookie to persist the data or


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

Open in new window

0
 

Author Comment

by:sitg
ID: 20332770
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"
0
 

Author Comment

by:sitg
ID: 20337466
my problem is still there.
no answer is resolving my problem
please help
0
 
LVL 33

Expert Comment

by:raterus
ID: 20349811
Again, Session is null and will always be null in Application_AuthenticateRequest, find another way.
0
 

Author Closing Comment

by:sitg
ID: 31410381
thanks .
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now