AFTER LOGOUT CANNOT WORK IN BACK BUTTON

AFTER LOGOUT CANNOT WORK IN BACK BUTTON


login.aspx


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="login" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table>
            <tr><td>username</td><td> <asp:TextBox ID="txtid" runat="server" ></asp:TextBox></td></tr>
            <tr><td>password</td><td> <asp:TextBox ID="password" runat="server" TextMode="Password" ></asp:TextBox></td></tr>
        </table>
  
        <asp:Button ID="bt1" runat="server" Text="login" OnClick="bt1_Click" />
    </div>
    </form>
</body>
</html>

login.aspx.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void bt1_Click(object sender, EventArgs e)
    {
        Session["id"] = txtid.Text.ToString();
        Response.Redirect("logout.aspx");
    }
}

logout.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="logout.aspx.cs" Inherits="logout" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type = "text/javascript" >
        function preventBack() { window.history.forward(); }
        setTimeout("preventBack()", 10);
        window.onunload = function () { null };
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="labuser" runat="server" ></asp:Label>
    <asp:Button ID="btlog" runat="server" Text="Logout" OnClick="btlog_Click" />
    </div>
    </form>
</body>
</html>

logout.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class logout : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
      
    }
    protected void btlog_Click(object sender, EventArgs e)
    {
        if (Session["id"] != null) Session.Remove("id");
        Response.Redirect("login.aspx");
    }
}

DOWNLOAD SOURCE CODE:logout code