Skip to content

Efficient Page Reloading in ASP .NET

Robert Greiner
Robert Greiner

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.

Please consider subscribing, it's free.
Technology

Robert Greiner Twitter

Professional optimist. I write a weekly newsletter for humans at the intersection of business, technology, leadership, and career growth.


Related Posts

Members Public

Navigating the Upside Down as a Technology Leader

Ideas for leading technology organizations with confidence and creativity.

Navigating the Upside Down as a Technology Leader
Members Public

Artist for a Day

The future of creative output is multiplied by AI.

Artist for a Day
Members Public

The Auto Industry's Cloud Awakening

Auto manufacturers are behind the cloud adoption curve but are well-positioned to unlock the future of mobility by building foundational capabilities across six key areas.

The Auto Industry's Cloud Awakening