troygoode / MembershipStarterKit

The starter kit provides the Asp.Net MVC controllers, models, and views needed to administer users & roles.
http://github.com/TroyGoode/MembershipStarterKit
MIT License
197 stars 66 forks source link

Razor Version=1 to Razor Version=2 (MVC3 to MVC4) #27

Closed SeanDbDev closed 12 years ago

SeanDbDev commented 12 years ago

Thank you for MvcMembership. I am fairly new to MVC and really enjoy the pattern. I used your MvcMembership to handle users and roles in my MVC3 application. It works flawlessly.

I just upgraded my web application by creating a new MVC4 application, pulling in my model files, et cetera, and now my “UserAdministration” pages give me this error:

[InvalidCastException:[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to[B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'in the context 'Default' at location'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_1.0.0.031bf3856ad364e35\System.Web.WebPages.Razor.dll'.Type B originates from 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.031bf3856ad364e35\System.Web.WebPages.Razor.dll'.]

Additionally, I noticed MVC4 uses “type="System.Web.Providers.DefaultRoleProvider"“, “type="System.Web.Providers.DefaultMembershipProvider"”, providers where MVC3 used “type="System.Web.Security.SqlRoleProvider"”, “type="System.Web.Security.SqlMembershipProvider"”.

Quick fixes? Should I switch my MVC4 to use the MVC3 providers? Should we start a new issue thread for this?

SeanDbDev commented 12 years ago

My apologies, it was a silly oversight on my part. I forgot about each view folder's web.config file. I updated it and all works fine now--even using the DefaultRoleProvider and DefaultMembershipProvider.