0

Is it possible to reroute all page requests to the Default.aspx if a certain Session variable is not set? I want the users to go to the default page where they agree to terms and conditions. On Accept, the Session["Accepted"] is set. Otherwise, if they try jump to any other page they should be drawn back to the default page.

Thanks.

Aamir
  • 791
  • 3
  • 15
  • 28

2 Answers2

0

Yes, you can use the FormsAuthorizationModule to do this, just like you would for checking authorization on a page. Check this out - http://www.asp.net/web-forms/tutorials/security/membership/user-based-authorization-cs

nsdiv
  • 912
  • 12
  • 30
  • Thank you. Your solution may very well have worked, but I applied the master page solution advised earlier and it was easier for me to apply. Will consider this if run into any problem with master page. Thanks very much any way! – Aamir May 31 '13 at 00:04
0

Implement following code in all pages page load methods except default.cs

if(Session["sessionkey"] == null)
{
Response.Redirect("~/Default.aspx");
}
  • Thank you Furqan, but that will to much. I have added a similar code you have suggested, but in the Master codebehind. Thanks any way for the advice! – Aamir Jul 20 '13 at 17:28