strong-typed profile values in ASP.NET membership (MVC)

后端 未结 1 1121
滥情空心
滥情空心 2021-01-23 20:51

I\'ve been using ASP.NET MVC with membership-based login for several years and everything is working fine (it\'s now MVC3, but membership didn\'t change since the first version

相关标签:
1条回答
  • 2021-01-23 21:00

    Joel Spolsky had a great answer to this question on this post. You're basically on the right track.

    If you're getting the illegal cast error, its most likely due to a problem in the config file. Make sure this is included; more specifically the <profile defaultProvider="SqlProvider" inherits="YourNamespace.AccountProfile"> section.

    <profile defaultProvider="SqlProvider" inherits="YourNamespace.AccountProfile">
        <providers>
             <clear />
             <add name="SqlProvider"
                  type="System.Web.Profile.SqlProfileProvider"
                  connectionStringName="sqlServerMembership" />
        </providers>
    </profile>
    
    0 讨论(0)
提交回复
热议问题