Hi, I hope this is a simple question.
login after Redirect to new page
I use The code,but error Thanks!!
Code:protected void btnLogin_Click(object sender, AjaxEventArgs e)
{
this.Window1.Hide();
Response.Redirect("Default2.aspx");
}
Printable View
Hi, I hope this is a simple question.
login after Redirect to new page
I use The code,but error Thanks!!
Code:protected void btnLogin_Click(object sender, AjaxEventArgs e)
{
this.Window1.Hide();
Response.Redirect("Default2.aspx");
}
I dont think you can do a server redirect during an ajax callback. You will have to render the necessary javascript back to the client. Also, there's no point in hiding window1 if you are going to change the window.location.
I confirm that Response.Redirect during AjaxEvent caused the exception. We will investigate it.
For now you can use next code for redirect
Code:string href = "AddScript.aspx";
this.ScriptManager1.AddScript("window.location='" + href + "';");
Hi wkcode,
During an AjaxEvent you can only return JavaScript to the Page to executed on a successful return.
The following code sample demonstrates a simple redirection after an <ext:Button> Click AjaxEvent.
Example
Hope this helps.Code:<script runat="server">
protected void Button1_Click(object sender, AjaxEventArgs e)
{
this.Button1.AddScript("window.location='MySecurePage.aspx';");
}
</script>
thanks!!
We added functionality within the Toolkit to automatically handle a Response.Redirect during an AjaxEvent.
You no longer need to add the "window.location" script.
The new code has been committed to SVN and will be publicly available with the v0.7.0 release.
One other interesting thing we found when researching this problem is that the <asp:UpdatePanel> does not support this functionality either. Apparently there is a work-around for the UpdatePanel, but out-of-the-box a Response.Redirect does not work during an UpdatePanel async postback.
Hi all,
I have the same problem and i have tried to follow your suggestions above but it doesn't redirect to my parent page. Help me please. Thanks.