From: Harlan Messinger on
Harlan Messinger wrote:
> 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.