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())
 
Back
Top