Role provider not working with SQL Server Enterprise
I am getting the following error,
The user instance login flag is not supported on this version of SQL Server. The connection will be closed.
from the below line of code in my razor view(MVC5)
I have upgraded my database sql server from Express 2012 to Enterprise 2012 edition . After that I got above error. Since my application is EF code-first, database is created automatically but role provider doesn't seem to be working.
<add name="Foo" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=Foo_db;User ID=sa;Password=******" providerName="System.Data.SqlClient" />
Check out this thread. It should help.
I have tested this, User.IsInRole is now working for me. Make sure you have this in your Startup class
Did you remember to put the application name in your web config?
<roleManager enabled="true"> <providers> <clear /> <add connectionStringName="ApplicationServices" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" applicationName="DONT FORGET THIS PART" /> </providers> </roleManager>