Hi ,
I am working on a ASP.NET website. I am redirecting the users to logout page if the session has expired. In the page load of Logout page, I am clearing all the session variables.
I want to redirect the users to login page from logout page on click on a link. I am checking Request.Params["__EVENTTARGET"] in page load to see if the post back is caused by link button click. but it always return null value. Link button click event does not fire. How to redirect users to login page from Logout page after the session has expired or cleared?
Logout.cs file:
//page load
string str = Request.Params["__EVENTTARGET"]; //returns always null
if (!IsPostBack)
{
Session.Clear();
Session.RemoveAll();
Session.Abandon();
}
// button click
protected void lnkLogin_Click(object sender, EventArgs e)
{
try
{
Response.Redirect("Login.aspx",true);
}
catch (Exception ex)
{
}
}
--Web config file
<authentication mode="Forms">
<forms loginUrl="~/Logout.aspx" timeout="2880" slidingExpiration="true"/>
</authentication>
Request.Params["__EVENTTARGET"] is always null in the page load of Logout page.
How to redirect users to login page from Logout page after the session has expired or cleared?
Thanks
Ashok
I am working on a ASP.NET website. I am redirecting the users to logout page if the session has expired. In the page load of Logout page, I am clearing all the session variables.
I want to redirect the users to login page from logout page on click on a link. I am checking Request.Params["__EVENTTARGET"] in page load to see if the post back is caused by link button click. but it always return null value. Link button click event does not fire. How to redirect users to login page from Logout page after the session has expired or cleared?
Logout.cs file:
//page load
string str = Request.Params["__EVENTTARGET"]; //returns always null
if (!IsPostBack)
{
Session.Clear();
Session.RemoveAll();
Session.Abandon();
}
// button click
protected void lnkLogin_Click(object sender, EventArgs e)
{
try
{
Response.Redirect("Login.aspx",true);
}
catch (Exception ex)
{
}
}
--Web config file
<authentication mode="Forms">
<forms loginUrl="~/Logout.aspx" timeout="2880" slidingExpiration="true"/>
</authentication>
Request.Params["__EVENTTARGET"] is always null in the page load of Logout page.
How to redirect users to login page from Logout page after the session has expired or cleared?
Thanks
Ashok