I’m developing web site using asp.net. In my web site after login i set session for the logged user for my web site need. and on each page i checked whether that session is null or having value and depending on the value i redirected to the login page.
My issue is that after login i want to redirect to the previously browsed web page and i done it by using following way-
code on the particular page for checking session value-
if (Session["EmployeeID"] != null)
{
}
else
{
Response.Redirect(ResolveUrl("~/login.aspx?IsTimeout=1"), true);
}
code on the login page-
If Request.QueryString("IsTimeout") IsNot Nothing Then
If Request.QueryString("IsTimeout") = "1" Then
Login1.DestinationPageUrl = Request.UrlReferrer.ToString()
End If
End If
Is there any other way to do this in correct way?
I’m not sure about the correct way… but im doing it something like this..
I have a function that request a login page and passes a parameter of the referrer
and here is the redirection after log in.