?
Solved

Context.Session is found null on postback,

Posted on 2007-11-21
10
Medium Priority
?
1,008 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 20

Accepted Solution

by:
REA_ANDREW earned 1500 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

771 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