K
Keithb
I am using the login control on my web site, which has both authenticated an
unauthenticated users. I added a logout page that is supposed to allow an
authenticated user to drop his authentication and resume operation as an
unauthenticated user. Using the below code in my logout page, the user is
taken directly to the login page immediately after logging out and has no
way of returning to the home page as an unauthenticated user.
protected void LinkButton1_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
}
As a workaround, I changed the web.config file to show the loginUrl as
Default.aspx instead of login_page.aspx, as shown below:
<forms name="Enterprise Integration Interfaces : Login"
loginUrl="Default.aspx" path="/" protection="All" timeout="60"></forms>
I also added FormsAuthentication.RedirectToLoginPage(); to the linkbutton
event hander on the logout page as shown below:
protected void LinkButton1_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
}
The workaround does solve the problem, however, it seems like a Kludge to
me, and I have the feeling that there is a 'proper' way to do this.
Can someone suggest a more elegant solution?
Thanks,
Keith
unauthenticated users. I added a logout page that is supposed to allow an
authenticated user to drop his authentication and resume operation as an
unauthenticated user. Using the below code in my logout page, the user is
taken directly to the login page immediately after logging out and has no
way of returning to the home page as an unauthenticated user.
protected void LinkButton1_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
}
As a workaround, I changed the web.config file to show the loginUrl as
Default.aspx instead of login_page.aspx, as shown below:
<forms name="Enterprise Integration Interfaces : Login"
loginUrl="Default.aspx" path="/" protection="All" timeout="60"></forms>
I also added FormsAuthentication.RedirectToLoginPage(); to the linkbutton
event hander on the logout page as shown below:
protected void LinkButton1_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
}
The workaround does solve the problem, however, it seems like a Kludge to
me, and I have the feeling that there is a 'proper' way to do this.
Can someone suggest a more elegant solution?
Thanks,
Keith