c# - ASP.Net MVC 5 using webconfig credentials and Membership.ValidateUser method -


i storing single credential in web.config file usual way:

    <authentication mode="forms">       <forms loginurl="~/login" timeout="2880">         <credentials passwordformat="clear">           <user name="admin" password="123" />         </credentials>       </forms>     </authentication> 

i aware of top notch security , password strength :).

then in custom authprovider class validate user usual (old) way:

bool result = formsauthentication.authenticate(username, password); 

and works fine, however, method deprecated (obsolete). want use new way (which believe right thing):

bool result = membership.validateuser(username, password); 

but exception:

a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server/instance specified)

there isn't problem accessing database, since showing "unauthenticated" content fine.

so question is... new solution save credentials in web.config without using deprecated methods? figured others might run same issue , curious understand why happening...

thank in advance!

there no equivalent in api formsauthentication.authenticate in mvc 5 if use membership.validateuser need define membership in webconfig server give role user active directory server.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -