Protect pages
-
Hi, In oder to protect my web pages,how I will redirect all user to a log-in page to check whether they are authorize or not? I ma using vb. Thanks in advance.
-
Hi, In oder to protect my web pages,how I will redirect all user to a log-in page to check whether they are authorize or not? I ma using vb. Thanks in advance.
Use this code to redirect all the access to login.aspx page in your site. Onto Web.config change the authentication mode
protection="All">
In order to check is the user session is active you must to create a session var on login event, And checked every time you load a form (Onload event) if isnt active the session var (Wasnt create) you redirect the user to out the site (Ex: logout.aspx) Use These lines to make that i told you on the lines behind Create var Session["Active"] = "is Active"; check varprivate void Page_Load(object sender, System.EventArgs e) { try { string active = Session["Active"].ToString(); } catch(Exception)//If the var never was create or timeout or killed { Response.Redirect("logout.aspx"); }
I hope you can step forward in your project with this solution. :-Dkeep Learning and you never will be out of date...
-
Use this code to redirect all the access to login.aspx page in your site. Onto Web.config change the authentication mode
protection="All">
In order to check is the user session is active you must to create a session var on login event, And checked every time you load a form (Onload event) if isnt active the session var (Wasnt create) you redirect the user to out the site (Ex: logout.aspx) Use These lines to make that i told you on the lines behind Create var Session["Active"] = "is Active"; check varprivate void Page_Load(object sender, System.EventArgs e) { try { string active = Session["Active"].ToString(); } catch(Exception)//If the var never was create or timeout or killed { Response.Redirect("logout.aspx"); }
I hope you can step forward in your project with this solution. :-Dkeep Learning and you never will be out of date...
-
Hi Britney.. thank you so much for your reply but I need code written in vb. Can you show? I am really sorry because I badly need a tutorial:sigh:.Thanks so much. I really appreciate it.