• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1674
  • Last Modified:

page refresh with response.redirect vs server.transfer

ASP.NET 2.0 VS2005

I have an ASP.NET application that is highly transactional. i.e about 20 text boxes on each page and data collected from each page updated to a SQL database . Lets call one of the pages  myPage.aspx.  The user enters data for the 20 or so textboxes and the hits an "Update" button which inserts a record to the SQL database. The users needs to start the next record.

Currently I am simply using  response.redirect("myPage.aspx") to reload the page and effectively clear the text boxes ready for the next transaction.

Is reloading the page with respons.redirect the best way of refreshing page textboxes and datagrids?

I am considering server.transfer("myPage.aspx") because it is more economical but it seems odd. i.e to  transfer page 'focus' on itself. I have only used this when progessing to another page and not for page reload.

I just need advise on what would be the best practice in a case like this.
  • 2
2 Solutions
Why don't you clear all your textboxes after saving ?
JenebyMAuthor Commented:
Because I found page reload clears 20 boxes with one line of code. If i used clear for 13 pages i would need to track clearing of 13 X 20 text boxes instead of 13 lines of code.

Additionally there are labels on the page which change mid-way through processing that need to revert to beginging of transaction.

Is clearing that number of textboxes and labes  faster than reloading the page with  redirect?
Here are some discussions about the differences of the 2:

"So, in brief: Response.Redirect simply tells the browser to visit another page. Server.Transfer helps reduce server requests, keeps the URL the same and, with a little bug-bashing, allows you to transfer the query string and form variables."  from the following link:


"Response.redirect provides a roundtrip to the server and server.transfer does not. For details search microsoft IIS help

Also Response.redirect redirects both the html page as well as the aspx page where as the server.transfer  transfers the  control only to the aspx pages"  from

http://weblogs.asp.net/jgalloway/archive/2004/07/21/189547.aspx  (This one is actually in favor of Server.Transfer sometimes)

Anyway, hopefully this can help you make your decision
JenebyMAuthor Commented:
I have looked at the differences between  the two before coming to post.

However, the question I am grappling with is NOT the differences during  navigation from one page to next.

The issues is using either on the SAME page to reload on postback. I.e the current page is myPage.aspx and I use reponse.redirect("myPage.aspx") to reload the SAME page. I have found that reloading the page this way is the easiest way to clear the text values preparatory to the next transaction on the same page after the record is updated.

Is this the only way to reload. (In effect I am looking for the equivalent of page.refresh from winforms)

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now