D
damiensawyer
Hi,
I have the following situation. If a user browses to http://domain/somemiscURL.aspx
without going through the front door I need to catch the request,
forward them to a login page and then, on completion, send them to the
original page that they requested.
My 'plan' was to do the following.
1/ Catch every request and test if it's "logged in" (determined by
existence of an object help in the Session
2/ If they fail, store the path that they requested in a session state
then redirect them to the login page
3/ On succesfull login, check the session variable of their original
request and send them on their way.
I've found the PostAcquireRequestState event on the httpApplication
object which, according to MSDN "Occurs when the request state (for
example, session state) that is associated with the current request
has been obtained".
From global.asax (simplified)
protected void Application_PostAcquireRequestState(object sender,
EventArgs e)
{
if (!clsWebFunctions.IsLoggedIn(Session) &&
(!Request.Url.ToString().Contains("HomePageURL")
{
Session["requestedpage"= Request.Url.ToString();
}
}
The issue is that I keep getting a "Session state is not available in
this context." error (on the call to IsLoggedIn).
Can someone please point me in the right direction?
Thanks in advance for your help,
Damien
I have the following situation. If a user browses to http://domain/somemiscURL.aspx
without going through the front door I need to catch the request,
forward them to a login page and then, on completion, send them to the
original page that they requested.
My 'plan' was to do the following.
1/ Catch every request and test if it's "logged in" (determined by
existence of an object help in the Session
2/ If they fail, store the path that they requested in a session state
then redirect them to the login page
3/ On succesfull login, check the session variable of their original
request and send them on their way.
I've found the PostAcquireRequestState event on the httpApplication
object which, according to MSDN "Occurs when the request state (for
example, session state) that is associated with the current request
has been obtained".
From global.asax (simplified)
protected void Application_PostAcquireRequestState(object sender,
EventArgs e)
{
if (!clsWebFunctions.IsLoggedIn(Session) &&
(!Request.Url.ToString().Contains("HomePageURL")
{
Session["requestedpage"= Request.Url.ToString();
}
}
The issue is that I keep getting a "Session state is not available in
this context." error (on the call to IsLoggedIn).
Can someone please point me in the right direction?
Thanks in advance for your help,
Damien