asp.net membership - Enabling FormsAuthentication for multiple subfolders in a site -


We are trying to implement formsAuthentication on our site, but in a scenario that we are not able to find solutions So far - in addition to creating their own HTML modules and custom logic itself - so I thought I would like to see this question that this is indeed the only solution.

We would like to use forms to authenticate at the top of custom subscription providers, but would like to use a different provider for different folders. With our site division these subfolders (like: ~ / Admin, ~ / GoldCustomer, ~ / SilverCustomer, ~ / BronzeCustomer), so we want to use different membership providers for each section / subfolder. Using the framework to support it, we have our web Conflict enforcement:

  & lt; Configuration xmlns = "http://schemas.microsoft.com/NetConfiguration/v2.0" & gt; & Lt; Location Path = "Admin" & gt; & Lt; System.web & gt; & Lt; Authentication mode = "form" & gt; & Lt; Form name = "AdminAuth" loginUrl = "~ / AdminLogin.aspx" /> & Lt; / Authentication & gt; & Lt; Subscription default provider = "AdminProvider" & gt; & Lt; Provider & gt; & Lt; Add connection StringName = "ConnString" name = "AdminProvider" type = "Assembly.AdminMembershipProvider" ... /> & Lt; / Providers & gt; & Lt; / Subscription & gt; & Lt; /system.web> & Lt; / Location & gt; & Lt; Location Path = "GoldCustomer" & gt; & Lt; System.web & gt; & Lt; Authentication mode = "form" & gt; & Lt; Form Name = "GoldCustomerAuth" loginUrl = "~ / GoldCustomerLogin.aspx" /> & Lt; / Authentication & gt; & Lt; Subscription default provider = "GoldCustomerProvider" & gt; & Lt; Provider & gt; & Lt; Add connection StringName = "ConnString" name = "GoldCustomerProvider" type = "Assembly.GoldCustomerMembershipProvider" ... = "" /> & Lt; / Providers & gt; & Lt; / Subscription & gt; & Lt; /system.web> & Lt; / Location & gt; & Lt; System.web & gt; & Lt; Compilation debug = "true" /> & Lt; Authentication mode = "form" / & gt; & Lt; /system.web> & Lt; / Configuration & gt;  

The result in the runtime error is doing this though:

There is an error in using a section registered as a permission level; MachineToApplication 'This error may be caused by IIS not being configured as a virtual directory.

  line 11: & lt; Location Path = "Admin" & gt; Line 12: & lt; System.web & gt; Line 13: & lt; Authentication mode = "form" & gt; Line 14: & lt; Form name = "formadmin" login URL = "~ / login.aspx" /> Line 15: & lt; / Authentication & gt;  

It seems that the only way we are trying is with the custom HTML module - or changing our approach (such as breaking folders in various web applications in IIS). Is this true, or am I missing something? Or are there other options I do not know?

Thank you for your help!

First of all, I think the role-based security is perfect for your application, if your Have close-up controls on the database. But if you can not change it, then it is not anybody.

An alternative solution can be a gateway login form, which can redirect the user to a specific login form based on the ReturnUrl querystring variable and that provider will use that provider Wants to validate Then it uses FormsAuthentication.RedirectFromLoginPage to set an authentication cookie and redirects to the previous page. web.config . In & lt; Authority & gt; You can set roles to control access to each folder with the tag and you can use role-based security.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -