SqlException: "Generating user instances in SQL Server is disabled"

R

R.A.M.

Hello,
I have started programming ASP.NET application using SQL Server 2005 Express
Edition. The problem is that when C# code tries to access aspnetdb database,
for example:
System.Security.Principal.IPrincipal user = HttpContext.Current.User;

if (user.IsInRole("Kierownik")) // HERE PROBLEM

....then the following run-time error occurs:

SqlException was unhandled by user code
Generating user instances in SQL Server is disabled. Use sp_configure 'user
instances enabled' to generate user instances.

Unfortunately executing sp_configure 'user instances enabled' on aspnetdb
database doesn't help (still the same error).

Please help.
/RAM/
 
P

Peter Bromberg [C# MVP]

a good way to get over this hurdle is to not use User Instances from the very
beginning, because if you are ever going to deploy your application you won't
be able to use a user-instance connection string at all.
So either attach the ASPNETDB database MDF file, or use ASPNET_REGSQL.EXE or
the System.Web.Management methods to create your ASP.NET membership database
tables, etc. in the database of your choice.

--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top