Efficient Page Reloading in ASP .NET

Efficient Page Reloading in ASP .NET

Today I ran into a situation where I needed to change some session state information on an ASP page I was developing and have it instantly update the current page. This can be accomplished with the following code:

//Stop processing and reload the current pageServer.Transfer(Request.Path);

Server.Transfer() transfers execution to a specified ASP page that does not force a new page request. This is more efficient than the old Response.Redirect() way of doing things.

Request.Path will get the path of the current request. Which, more simply put, will point straight back to the page you are currently on.

Put these two together and you have a recipe for success when you want to make your page stop processing and begin again.

Robert Greiner

Robert Greiner

Professional optimist. Passionate about cultivating high-performing teams @ scale by integrating the timeless wisdom of the past with the marvel of today's emergent technology in a practical way.

View Comments
Next Post

Generating an XML Document Using LINQ to XML

Previous Post

How to set a default browser when debugging in VisualStudio

Subscribe for free

Subscribe to my newsletter and get the latest posts delivered right to your inbox for free. I don't spam and your email won't be shared with third-parties.

Thanks for subscribing!

Check your inbox to confirm your subscription.

Please enter a valid email address!