2
votes

I am getting 'Resource cannot be found' error with the following URL Response.Redirect. If I use Response.Redirect("~/Orders/ViewOrders.aspx"), it works fine. What could be wrong? Thanks for any suggestions.

Here is the output of the URL string.

~/Orders/ViewOrders.aspx?url='http://servername/Reports/Pages/ReportViewer.aspx?/test/test_orders&rs:Command=Render'

Here is my code.

string url = string.Format("~/Orders/ViewOrders.aspx?url='{0}'", editItem.Cells[14].Text); Response.Redirect(url);

1

1 Answers

3
votes

You need to encode the querystring

string url = string.Format("~/Orders/ViewOrders.aspx?url={0}"
  , Server.UrlEncode(editItem.Cells[14].Text)); 
Response.Redirect(url);

Also, I do not think you should have those single quotes. I removed them.