views:

54

answers:

1

I always put calls to Response.Redirect in my WebForm's OnLoad method, mostly because every example I've seen do that. I was wondering if it was any more efficient (and correct) to do that in OnPreInit? Even if the endResponse param is true?

+1  A: 

Obviously, the sooner the better. Don't make your server do any more work than it needs to before redirecting to the real page of interest.

However, you don't always know you want to redirect prior the page load event, or even later- perhaps after handling a button press event.

Joel Coehoorn