tomouse
Technical User
- Aug 30, 2010
- 50
Hello,
I have code on the page_init method of my masterpage that picks up the name of the logged in user and checks that this user is stored in the database. If the user isn't found in the database I want to display the content page "UnknownUser.aspx".
However, redirecting to this page (using Response.redirect("pagename.aspx") causes the page init of the masterpage to fire again, which checks the logged in user and redirects to the content page again, thus creating an infinite loop. What is the best way to prevent this? Should I move this code to some other location? Or is there a way to prevent the content page firing the masterpage init event?
I have code on the page_init method of my masterpage that picks up the name of the logged in user and checks that this user is stored in the database. If the user isn't found in the database I want to display the content page "UnknownUser.aspx".
However, redirecting to this page (using Response.redirect("pagename.aspx") causes the page init of the masterpage to fire again, which checks the logged in user and redirects to the content page again, thus creating an infinite loop. What is the best way to prevent this? Should I move this code to some other location? Or is there a way to prevent the content page firing the masterpage init event?