Failed to generate a user instance of SQL Server. Only an integratedconnection can generate a user i

H

Harlan Messinger

I'm using Visual Studio 2008 and SQL Server Express 2008. I've built the
beginnings of an ASP.NET 3.5 app that reads a connection string from the
configuration, in the usual way, and I can use LINQ-to-SQL against it
and output listings of data from the database to a page with no problem.

But I've created a custom membership provider that uses this string to
create a data context for LINQ-to-SQL, and placed a Login control on a
page that uses this membership provider. This page opens fine when I run
it from Visual Studio, but when I enter some text into the login form
and submit it, the error message "Failed to generate a user instance of
SQL Server. Only an integrated connection can generate a user instance."
appears in the browser. Visual Studio, meanwhile, doesn't give me any
indication that there's a problem. The details under the error message
in the browser go on about the App_Data directory, but my App_Data
directory is empty and I haven't referred to it anywhere.

Any ideas on the source of the trouble?
 
H

Harlan Messinger

Harlan said:
I'm using Visual Studio 2008 and SQL Server Express 2008. I've built the
beginnings of an ASP.NET 3.5 app that reads a connection string from the
configuration, in the usual way, and I can use LINQ-to-SQL against it
and output listings of data from the database to a page with no problem.

But I've created a custom membership provider that uses this string to
create a data context for LINQ-to-SQL, and placed a Login control on a
page that uses this membership provider. This page opens fine when I run
it from Visual Studio, but when I enter some text into the login form
and submit it, the error message "Failed to generate a user instance of
SQL Server. Only an integrated connection can generate a user instance."
appears in the browser. Visual Studio, meanwhile, doesn't give me any
indication that there's a problem. The details under the error message
in the browser go on about the App_Data directory, but my App_Data
directory is empty and I haven't referred to it anywhere.

Any ideas on the source of the trouble?

I had neglected to set the MembershipProvider property on the control!
Sorry.
 
J

John Bell

I'm using Visual Studio 2008 and SQL Server Express 2008. I've built the
beginnings of an ASP.NET 3.5 app that reads a connection string from the
configuration, in the usual way, and I can use LINQ-to-SQL against it
and output listings of data from the database to a page with no problem.

But I've created a custom membership provider that uses this string to
create a data context for LINQ-to-SQL, and placed a Login control on a
page that uses this membership provider. This page opens fine when I run
it from Visual Studio, but when I enter some text into the login form
and submit it, the error message "Failed to generate a user instance of
SQL Server. Only an integrated connection can generate a user instance."
appears in the browser. Visual Studio, meanwhile, doesn't give me any
indication that there's a problem. The details under the error message
in the browser go on about the App_Data directory, but my App_Data
directory is empty and I haven't referred to it anywhere.

Any ideas on the source of the trouble?

Hi

The error suggests that you don't have Integrated Security=True in the
connection string, but I would expect that you would get that from
visual studio if it was the case.If you are using a forms based
authentication I would expect that you are trying to enter as username
and password for the connection i.e. SQL Server authentication, in
which case you can create a user instance.

John
 

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