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

AI Rule #1 - Customer First

In 1985, Warren Buffett wisely said, "The first rule of investment is don't lose. And the second rule of investment is don't forget the first rule, and that's all the rules there are." Similarly, the first rule of AI investment is to

AI Rule #1 - Customer First
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