在MVC 4创建自定义Memebership Provider始终得到错误 [英] Create Custom Memebership Provider in MVC 4 Always get error
问题描述
我试图开发自定义成员提供,以我自己的数据库表使用,但我不能。跑项目后我看到的web.config定义成员资格提供线红色的错误线。 :(键入=Mvc4ApplicationTest2.Models.CustomMembershipProvider
我发现一篇文章,说我下面几行添加到web.config中我做了。
I tried to develop custom membership provider in order to use with my own database tables but I couldn't. After run project I saw red error line on web.config custom membership provider line. :(
type="Mvc4ApplicationTest2.Models.CustomMembershipProvider"
I found article that said me to add below lines to web.config and I did.
add key="enableSimpleMembership" value="false"
add key="autoFormsAuthentication" value="false"
现在运行的应用程序:)但得到到登录页面后点击提交,我得到新的错误暗示我这个样子:
Now application run :) but after get to login page and clicked on submit i get to new error that hint me like this:
To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".
我再次搜查,我发现了一些文章说我必须事先线的web.config,但与真正的增值!? 添加关键=enableSimpleMembershipVALUE =真
我感到困惑。 ?(
所以,我能做些什么?每个人都可以帮帮我吗?
和其他的问题,我要使用标准的,强大和有效的方法来保护我的Web应用程序。你想,如果我必须用websecurity类或其他的方法呢?
Again I searched and I found some articles says me have to add prior line to web.config but with true value !!? add key="enableSimpleMembership" value="true"
I confused. ?(
So What can I do? Can everyone please help me?
and other question, I want to use the standard, strong and useful method to secure my web application. do you think if I must use websecurity classes or other approach?
真诚
阿里
推荐答案
搜索了很多,阅读了许多文章后,我发现它最后。那是愚蠢的错误。我以前从 System.Web.Security.MembershipProvider 继承。所以我把错误约需要 ExtendedMembershipProvider 的实施。所以,我没有它的 WebMatrix.WebData.ExtendedMembershipProvider ,然后每一个事情的罚款。感谢所有提供咨询和帮助。
After searching a lot and reading many articles I found it Finally. That is stupid mistake. I used to inherit from System.Web.Security.MembershipProvider. so I took error about needing ExtendedMembershipProvider implementation. So I did it with WebMatrix.WebData.ExtendedMembershipProvider and then every things were fine. Thanks for all advises and helps.
这篇关于在MVC 4创建自定义Memebership Provider始终得到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!