Server.Transfer

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I had the following code line when a button was clicked:

Response.Redirect(Me.Request.Url.AbsolutePath)

I am using this to refresh the page.

However, I need to preserve the Query String if the page has any and
Response.Redirect is not doing it.

So I changed it to:

Server.Transfer(Me.Request.Url.AbsolutePath)

Now I am getting an error:

System.InvalidOperationException: Failed to map the path
'/MyWebSite/News.aspx'.

Could someone tell me how to refresh the page and keep the QueryString?

Thanks,

Miguel
 
Hello shapper,

If you're posting back to yourself, you should be able to do something like:

Response.Redirect(Me.Request.Url.AbsolutePath + "?" +
Request.QueryString.ToString())
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top