asp.net - How to deny users and redirect to login page when they type the same url in web page -
after login enter librarianform. when copy url , paste in new tab it's showing page without login. want redirect users login page when copy , paste url. how that.can please explain it. thank you.
asp.net has login mechanism can use. enable it, add below in web.config
file. change loginurl
attribute path of own login page.
<configuration> <system.web> <authentication mode="forms"> <forms loginurl="~/login.aspx" timeout="28800" name="webappname" /> </authentication> </system.web> </configuration>
to create asp.net authentication cookie need call formsauthentication.redirectfromloginpage
can see below
string username = ""; bool rememberme = true; // implement own login mechanism , if user authenticated // set username variable , make call below formsauthentication.redirectfromloginpage(username, rememberme);
finally, logout user can call
formsauthentication.signout();
you can see link, describes similar mechanism
Comments
Post a Comment