Tuesday, 14 February 2012

Configuring Roles/Membership SQL to not use DBO?

I have a site with roles/membership working fine on my local machine, but I am having serious trouble deploying it to a shared host. My hosting provides a sql 2000 database, but the user created for it that I use is not dbo. I am errors when I try to access my site such as

Couldnot find storedprocedure'dbo.aspnet_CheckSchemaVersion'
The procedure was created under my user, so it's there, but it's full name ia myusername.aspnet_CheckSchemaVersion
How can I tell the asp.net membership/role provider to use my username instead of dbo when it looks for objects?
 
Thanks 

Configure your website to use a user with myusername as the default schema for your role/membership. By default the role/membership use a connection string named 'LocalSqlServer', so you can change login information of this connection string. For details, please refer to this article:

http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx

|||

I had my username configured in the connection string, it was just ignoring it. Well, it was connecting to the SQL server with my username, but was still looking for stored procedures using dbo.

Luckily, the blog you linked to did have the source code for the default MS SQL providers. When I looked at the source code for Microsoft's membership/roles providers I found out why it wasn't working. dbo is hard coded into all the stored procedure calls. Makes it kinda hard to use on shared servers where you aren't the dbo.

Anyway, I downloaded the source code, removed all the dbo. calls, recompiled and set up a custom provider to use my new dbo-free sql providers.

Works like a champ. So, consider this one solved.

|||You mentioned getting the source code for the MS SQL providers. Can you tell me where you got that? I found the Access provider athttp://msdn.microsoft.com/asp.net/beta2/providers/default.aspx from the link above. But I can't seem to find the SQL provider. Any help would be much appreciated. Thanks.|||

asylumn:

I had my username configured in the connection string, it was just ignoring it. Well, it was connecting to the SQL server with my username, but was still looking for stored procedures using dbo.

This may because you have something like 'Integrated Security=SSPI' in the connection string, which force to connect using Windows Authentication so the username would be ignored. Still, I'm glad to hear you've solved this issueSmile

|||

jbutler76:

You mentioned getting the source code for the MS SQL providers. Can you tell me where you got that? I found the Access provider athttp://msdn.microsoft.com/asp.net/beta2/providers/default.aspx from the link above. But I can't seem to find the SQL provider. Any help would be much appreciated. Thanks.

Hi jbutler76, Scott has repied you on his bolg, you may check here to find the SQL Provider Source:

http://weblogs.asp.net/scottgu/archive/2006/04/13/Source-Code-for-the-Built_2D00_in-ASP.NET-2.0-Providers-Now-Available-for-Download.aspx

No comments:

Post a Comment