Response.Redirect - best practices

D

Don

When we redirect a user to a new page, we generally want the processing
of the current page to end right then. As I understand it, the runtime
accomplishes this by generating a ThreadAbort exception. But suppose
the page has set a Session variable and we're using out-of-process
sessions. Is the thread that persists the Session variable (to the
StateServer or SqlServer) being aborted? Can we be 100% sure that the
Session variable will be persisted?

The documentation states that Session variables aren't persisted if
there's an error on the page. Does that include a ThreadAbort? Are
timing considerations involved?

Bottom line: when using out-of-process sessions, is it safe to allow
the ThreadAbort exception or should we say Response.Redirect(url,
false) and terminate page processing through logic on the page?

Thanks for any authoritative responses.

Don Smolen, MCSD
 
C

Chris Botha

The following should do it:
Response.Clear()
Response.Redirect(...)
Response.End()

Cant see why you need ThreadAbort.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top