Redirect

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a web page which accepts a query string to retrieve the record that the user wants. The user could then select different values as which cases I am re-directing back to the same page with a response.redirect with the new query string. If I watch this in the debugger it seems to go back to the client more then once to server up the page. Should I be using another method to redirect back to the same page with a new query string. The main reason why I am wanting to come back into the program with the approriate query string is so that the user can book mark the apge appropriately

Any suggestions?
 
Jim Heavey said:
I have a web page which accepts a query string to retrieve the record that
the user wants. The user could then select different values as which cases
I am re-directing back to the same page with a response.redirect with the
new query string. If I watch this in the debugger it seems to go back to
the client more then once to server up the page. Should I be using another
method to redirect back to the same page with a new query string. The main
reason why I am wanting to come back into the program with the approriate
query string is so that the user can book mark the apge appropriately.

What makes you believe that it "goes back to the client more than once"?

What happens is that the client makes a request to your page. You respond
with a Response.Redirect, which sends a redirect status back to the client
along with the URL you're trying to redirect to. When the client sees this,
it will request the new URL.
 
This behaviour is by desing. If you use response.redirect, Response.Redirect
tells the browser to request a different page. Since a
redirect forces a new page request, the browser has to make two round trips
to the Web server, and the Web server has to handle an extra request.

If you want to avoid this round trip, you need to use server.transfer. But
that wont change the url of that page with new querystring, so your user may
not be able to bookmark your page.


--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com



Jim Heavey said:
I have a web page which accepts a query string to retrieve the record that
the user wants. The user could then select different values as which cases
I am re-directing back to the same page with a response.redirect with the
new query string. If I watch this in the debugger it seems to go back to
the client more then once to server up the page. Should I be using another
method to redirect back to the same page with a new query string. The main
reason why I am wanting to come back into the program with the approriate
query string is so that the user can book mark the apge appropriately.
 
Back
Top