2

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 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.