Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Participant
1598 Points
378 Posts
May 10, 2012 08:07 AM|LINK
Add following in <System.Web> section in Web.Conf. Put your login page url and default page url where mentioned.
<authentication mode="Forms"> <forms cookieless="AutoDetect" defaultUrl="Default Page" loginUrl="Your Login PageUrl" r timeout="Session Time in Minutes" slidingExpiration="true"/> </authentication> <authorization> <allow users="*"/> </authorization>
Now in masterpage load event or in those pages where user authentication is needed do it in Page_Load Event:
if(!Request.IsAuthenticated)//if user is not authenticated{ FormsAuthentication.RedirectToLoginPage();//not allow to access and redirect to login}
It will work even if you are not using login control. I am successfully using it my project.
mishra.bhupe...
Participant
1598 Points
378 Posts
Re: How to stay the login user to be logged in when navigating in different pages
May 10, 2012 08:07 AM|LINK
Add following in <System.Web> section in Web.Conf. Put your login page url and default page url where mentioned.
<authentication mode="Forms"> <forms cookieless="AutoDetect" defaultUrl="Default Page" loginUrl="Your Login PageUrl" r timeout="Session Time in Minutes" slidingExpiration="true"/> </authentication> <authorization> <allow users="*"/> </authorization>Now in masterpage load event or in those pages where user authentication is needed do it in Page_Load Event: