page refresh with response.redirect vs server.transfer

Posted on 2007-07-27
Last Modified: 2013-11-07
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.
Question by:JenebyM
    LVL 53

    Assisted Solution

    Why don't you clear all your textboxes after saving ?

    Author Comment

    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?
    LVL 1

    Accepted Solution

    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  (This one is actually in favor of Server.Transfer sometimes)

    Anyway, hopefully this can help you make your decision

    Author Comment

    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)


    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    md5sum check using powershell v 1.0 4 39 check for multiple values 5 29
    call function 8 34
    send mail from 8 12
    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now