clicking browser back button is opening a link in the previous page.

Posted by Jebli on Stack Overflow See other posts from Stack Overflow or by Jebli
Published on 2010-04-22T14:57:21Z Indexed on 2010/04/22 20:33 UTC
Read the original article Hit count: 263

Filed under:
|

I am using the below code

protected void lnk_Click(object sender, EventArgs e)
    {
        try
        {
            string strlink = ConfigurationManager.AppSettings["link"].ToString().Trim();
            StringBuilder sb = new StringBuilder();
            sb.Append("<script type = 'text/javascript'>");
            sb.Append("window.open('");
            sb.Append(strlink);
            sb.Append("');");
            sb.Append("</script>");
            ClientScript.RegisterStartupScript(this.GetType(), "script", sb.ToString());

        }
}

In the page there are two links. When i click the first link it opens a window in a new page. I do this by using the above code.

I am clicking the second link in the page and navigating to another page. Now i am clicking the browser back button. Supprisingly its opening the first link.

How clicking back button is opening the link in the page.

I am using c# .net 2005.

Please help. Thanks.

Regards,enter code here Radha A

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about visual-studio-2005