Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring Membership Provider with credentials setup in web.config

I'm trying to implement Forms Authentication in ASP.NET MVC4 application and I've only one user who is going to get authenticated to do some admin activities.

<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 I'm supposed to use now Membership class.

My question is how I can configure membership provider in web.config to use the credentials setup in the web.config? What provider I should specify in the name attribute?

like image 974
VJAI Avatar asked Nov 04 '22 11:11

VJAI


1 Answers

Unfortunately, there is no built-in membership provider for the mechanism of storing the credentials in the web.config as you describe. You could write your own to invoke the FormsAuthentication.Authenticate method or call this from your own custom login control's code-behind.

like image 154
Jonathan Williams Avatar answered Nov 15 '22 07:11

Jonathan Williams