I have the following code in my Visual Studio 2010 C# Web Application. The Web application has the Windows Authentication
enabled in IIS.
<script runat="server">
void Signout_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
Response.Redirect("WebForm1.aspx");
}
</script>
<body>
<form id="form1" runat="server">
<div>
<span class="style1"><strong>
<asp:HyperLink ID="Link_Home" runat="server" NavigateUrl="~/WebForm1.aspx">Home</asp:HyperLink> |
<asp:Button ID="Submit1" OnClick="Signout_Click" Text="Sign Out" runat="server" />
</strong></span><br />
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
However, I notice that the FormsAuthentication.SignOut();
seem not working. This is because when I click the button. It is suppose to logout and clear the current user so that when another user come to this page, it should prompt for password.
However, when I open another tab and enter the web application url, it did not prompt me for username or password. It is only when the web browser is close and open again with the web application url, then it prompt me for the username and password.
Appreciate if anyone can help me.