ASP.NET File Upload Progress - Knowledge Base

« Back to Knowledge Base list

Redirect when StatusPanel is used

Q:

  I use StatusPanel control in my page for images uploading. In server-side I want to go to a different page when no files were uploaded (Response.Redirect("default.aspx")). It causes an error and I get the dialog box "Not found in response page...".

A:

Put the following function to your page and use it instead of Response.Redirect .

protected void RedirectFromStatusPanel(string url) {
  Response.Write("<scr"+"ipt type=\"text/JavaScript\">parent.document.location.href=\""+url+"\";</sc"+"ript>");
  Response.End();
}