1.In your
Page_Init
and
Page_Load
of your
Login.aspx.cs
page, used for form authentication add the code like in the next example.
protected void Page_Init(object sender, EventArgs e)
{
if (!IsPostBack)
{
Session.Clear();
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FormsAuthentication.SignOut();
}
}
2.In your
web.config
you must set form authentication like in the next example:
<authentication mode="Forms">
<forms loginUrl="Login.aspx" timeout="2880" />
</authentication>
3.In your master page the
LoggedInTemplate
section must be similar with the next code:
<LoggedInTemplate>Hello<span class="bold">
<asp:LoginName ID="HeadLoginName" runat="server" />
</span>! [
<asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Logout"
LogoutPageUrl="~/" />
]
</LoggedInTemplate>
4.At the logout time, you could delete the browser cache as is indicated in the next article:
http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers[
^]