Auto-redirect in Application_Beginrequest?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In certain situations I'd like to prevent users from accessing my
default.aspx page and automatically redirect them to an alternative page.

Would it be feasible to do this in Application_Beginrequest in global.asax,
or is there a better way.

This functionality needs to be configured on a per-session basis.
 
You should not do it in Application_BeginRequest if you reply upon Session
because Session has not yet been loaded and made avaialable at that point.
Instead you should do it in Application_PreRequestHandlerExecute.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
Hi Brock,

Thanks for your response. Hope you had a nice xmas.

How would I go about doing this? Should I just use standard
Response.Redirect()?

ie:

if (Request.RawUrl.ToUpper().IndexOf("DEFAULT.ASPX") > -1) {
Response.Redirect("otherdefault.aspx");
}

Thanks

Ben
 

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

Back
Top