Solved

Context.Session is found null on postback,

Posted on 2007-11-21
10
1,001 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 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
Technology Partners: 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

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

734 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