i have made 2 pages....1 for login n next to show after successful login....
on login page i have created a button....in its handler i have created session.... on the load event of next page i m checking for the availibity of the session variable n its value.... its workin well..... but the problem comes when i press back button of the browser.....after signing out when i press back button the page is being displayed.....(this should not happend).... can anyone help me regarding this...?? plz reply soon....

Recommended Answers

All 2 Replies

Use the following code in ur head tag

<script language="JavaScript" type="text/javascript">
javascript:window.history.forward(1);

</script>

i have made 2 pages....1 for login n next to show after successful login....
on login page i have created a button....in its handler i have created session.... on the load event of next page i m checking for the availibity of the session variable n its value.... its workin well..... but the problem comes when i press back button of the browser.....after signing out when i press back button the page is being displayed.....(this should not happend).... can anyone help me regarding this...?? plz reply soon....

Turn off client & proxy cache,

protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        if (Session["iskey"] == null)
        {
            Response.Redirect("~/Login.aspx");
        }
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.