Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1017
  • Last Modified:

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
0
sitg
Asked:
sitg
  • 5
  • 2
  • 2
  • +1
1 Solution
 
REA_ANDREWCommented:
HttpContext.Current.Session["YourSession"] is the fully qualified version.  You missed of the Context

Andrew
0
 
raterusCommented:
I don't think it's possible to access the Session in Application_AuthenticateRequest
0
 
sitgAuthor Commented:
i mean the same
it is also returning null.
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
sitgAuthor Commented:
HttpContext.Current.Session is returing null
0
 
surajgupthaCommented:
Shouldnt the session get established only AFTER a successfull login??
0
 
REA_ANDREWCommented:
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
 
sitgAuthor Commented:
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
 
sitgAuthor Commented:
my problem is still there.
no answer is resolving my problem
please help
0
 
raterusCommented:
Again, Session is null and will always be null in Application_AuthenticateRequest, find another way.
0
 
sitgAuthor Commented:
thanks .
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 5
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now