validation - ASP.Net MVC 5 -Attempt by security transparent method 'WebMatrix.WebData.SimpleMembershipProvider.ValidateUser to access security method failed -


i using simplemembership in asp.net web api project. when try validate user using below code, error(error 1)

 if (!membership.validateuser(username, password))        {          throw new validationexception("username or pwassword incorrect.");        } 

error 1:

attempt security transparent method 'webmatrix.webdata.simplemembershipprovider. validateuser(system.string, system.string)' access security critical method 'system.web.webpages.stringextensions.isempty(system.string)' failed.

earlier got similar error(error 2) resolved installing these packages:

install-package microsoft.aspnet.webhelpers  install-package microsoft.aspnet.webpages.data 

error 2:

attempt security transparent method 'webmatrix.webdata.preapplicationstartcode.onconnectionopened( system.object, webmatrix.data.connectioneventargs)' access security critical method 'system.web.webpages. httpcontextextensions.registerfordispose(system.web.httpcontextbase, system.idisposable)' failed.

i did clean solution , tried, still getting same error, need install more packages or simplemembership work in web api?

the current fix me upgrading .net 4.5.3. figured out of frustration. issue doesnt affect mvc 5 core webmatrix projects after upgrading webpages 3.2.3. think framework issue fixed new microsoft identity. current fix me below: note: please use property pages wizard in visual studio change target framework .net framework 4.5.3. update web.config

<compilation debug="true" targetframework="4.5.3">   <assemblies>     <add assembly="system, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089"/>   </assemblies> </compilation> 

step 1: install-package microsoft.aspnet.webhelpers

step 2: install-package microsoft.aspnet.webpages.data

step 3: [optional] install-package owin

step 4: change targetframework .net 4.5.3 via property pages dialog box

enter image description here


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

c - Expected expression before 'struct' - Error -