Hello,
I am developing a Website using VS 2012, my webapp project has Defualt.aspx , which is a login page and the project has many others .aspx pages.
My intention is to restrict non-logged in users from accessing any page other than Default.aspx, and also may be redirect the user to Default.aspx.
I also want to redirect user to Default.aspx when the session gets expired.
I can accomplish both these by Checking for SessionID in Page_load of all pages other than Default.aspx, something like below:
if (Session["UserID"] == null)
{
Response.Redirect("~/Default.aspx");
}
Can someone advise if this will be a good approach to follow?
I am wondering if there is a way to do this by authorization setting in web.config, though I tried and it didn't work for me.
TIA!
Go to the complete details ...