Configuring a membership provider with credential settings in web.config

I am trying to implement forms authentication in an ASP.NET MVC4 application, and I only have one user who will authenticate to perform some admin actions.

<authentication mode="Forms"> <forms timeout="2880" loginUrl="~/Admin/Login" slidingExpiration="true"> <credentials passwordFormat="Clear"> <user name="user" password="password"/> </credentials> </forms> </authentication> 

When I try to use the FormsAuthentication.ValidateUser method, I get an obsolete warning, and now I have to use the Membership class.

My question is, how can I set up a membership provider in web.config to use credential settings in web.config? Which provider should I specify in the name attribute?

+4
source share
1 answer

Unfortunately, there is no built-in membership provider for the credential storage mechanism in web.config, as you describe. You can write your own to call the FormsAuthentication.Authenticate method or to call it from your own custom input control code.

+2
source

Source: https://habr.com/ru/post/1444816/


All Articles