Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 08, 2012 09:18 AM by Dave Sussman
Member
37 Points
90 Posts
Feb 08, 2012 07:20 AM|LINK
Hi Everyone,
Can anyone tell me how to formsauthenticate for two subfolders with only one login form.
Example. i want to authenticate Admin folder and User folder in the root directory. it should be redirect to root login form.
Thanks in Advance,
Kishore Kumar
All-Star
86555 Points
9624 Posts
Moderator
MVP
Feb 08, 2012 09:13 AM|LINK
Use the standard forms authentication setup:
<system.web> <authentication mode="Forms"> <forms loginUrl="Login.aspx" protection="All" timeout="30" name=".ASPXAUTH" path="/" requireSSL="false" slidingExpiration="true" defaultUrl="default.aspx" cookieless="UseDeviceProfile" enableCrossAppRedirects="false" /> </authentication> </system.web>
Then add location elements for admin and user folders like this:
<location path="admin"> <system.web> <authorization> <deny users="?" /> <allow users="*" /> </authorization> </system.web> </location>
<location path="users"> <system.web> <authorization> <deny users="?" /> <allow users="*" /> </authorization> </system.web> </location>
37716 Points
5005 Posts
ASPInsiders
Feb 08, 2012 09:18 AM|LINK
This is an authorization issue, where you have a single login page (authentication), then authorization rules that lock down the Admin and User folder dependent upon the logged in users roles. Read up on these at:
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/security/default.aspx
http://www.asp.net/web-forms/tutorials/security/membership/user-based-authorization-cs
http://www.asp.net/web-forms/tutorials/security/roles/role-based-authorization-cs
kishore309
Member
37 Points
90 Posts
Need FormsAuthentication for two subfolders
Feb 08, 2012 07:20 AM|LINK
Hi Everyone,
Can anyone tell me how to formsauthenticate for two subfolders with only one login form.
Example. i want to authenticate Admin folder and User folder in the root directory. it should be redirect to root login form.
Thanks in Advance,
Kishore Kumar
Kishore Kumar
DarrellNorto...
All-Star
86555 Points
9624 Posts
Moderator
MVP
Re: Need FormsAuthentication for two subfolders
Feb 08, 2012 09:13 AM|LINK
Use the standard forms authentication setup:
<system.web> <authentication mode="Forms"> <forms loginUrl="Login.aspx" protection="All" timeout="30" name=".ASPXAUTH" path="/" requireSSL="false" slidingExpiration="true" defaultUrl="default.aspx" cookieless="UseDeviceProfile" enableCrossAppRedirects="false" /> </authentication> </system.web>Then add location elements for admin and user folders like this:
<location path="admin">
<system.web>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="users">
<system.web>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
</system.web>
</location>
Darrell Norton's Blog
Please click "Mark as Answer" if this helped you.
Dave Sussman
All-Star
37716 Points
5005 Posts
ASPInsiders
MVP
Re: Need FormsAuthentication for two subfolders
Feb 08, 2012 09:18 AM|LINK
This is an authorization issue, where you have a single login page (authentication), then authorization rules that lock down the Admin and User folder dependent upon the logged in users roles. Read up on these at:
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/security/default.aspx
http://www.asp.net/web-forms/tutorials/security/membership/user-based-authorization-cs
http://www.asp.net/web-forms/tutorials/security/roles/role-based-authorization-cs