ASP .NET Button event handlers do not fire on the first click, but on the second click after a PostBack

后端 未结 8 2060
Happy的楠姐
Happy的楠姐 2020-12-02 17:02

Background: I am customizing an existing ASP .NET / C# application. It has it\'s own little \"framework\" and conventions for developers to follow when exte

8条回答
  •  感动是毒
    2020-12-02 17:29

    Even i had the same problem. the cause was "localhost:1656/secure/login.aspx?ReturnUrl=%2f". if the request contain %2f as query string, the first post will not be succeeded even though "%2f" is representing "/".

    one way to avoid this by having a condition check in pageload

    protected void Page_Load(object sender, EventArgs e)
    {
        string queryString = Request.QueryString.ToString();
        if(queryString == "ReturnUrl=%2f")
        {
            Response.Redirect("/secure/login.aspx");
        }
    }
    

提交回复
热议问题