473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Connection string not working when moving from sqlexpress to sqlserver

Hi

I am manually able to create a connection to my db in the vs2005 ide using
Tools->Connect to Database. In the connection I see 'Data
Source=MYSERVER;Initial Catalog=aspnetdb;Integrated Security=True' as the
connection string and 'NET Framework Data Provider for SQL Server' as the
provider. Following these settings in my code and I have used the connection
string;

<add name="Membership" connectionString="Data Source=MYSERVER;Initial
Catalog=aspnetdb;Integrated Security=True"
providerName="System.Data.SqlClient"/>

in my app's web.config file. This connection is then used by a custom
membership provider for the create user wizard. Now when I try to create a
new user in the wizard I get the following error;

System.Data.SqlClient.SqlException: Cannot open database "aspnetdb"
requested by the login. The login failed.
Login failed for user 'MYSERVER\ASPNET'.

I was able to work fine when the db was on sql express. What is the problem
and how can I fix it?

Thanks

Regards

Dec 18 '05 #1
2 5330
John,

When you connect to the database using integrated security from the ide the
application passes your credentials to the database. When ASP.NET is running
as a server and using integrated security it is passing the credentials that
your website is running as (most likely IUSR_[MachineName]) you'll need to
give whichever user account your site is running under the appropriate
permissions to the database.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hi

I am manually able to create a connection to my db in the vs2005 ide using
Tools->Connect to Database. In the connection I see 'Data
Source=MYSERVER;Initial Catalog=aspnetdb;Integrated Security=True' as the
connection string and 'NET Framework Data Provider for SQL Server' as the
provider. Following these settings in my code and I have used the
connection
string;

<add name="Membership" connectionString="Data Source=MYSERVER;Initial
Catalog=aspnetdb;Integrated Security=True"
providerName="System.Data.SqlClient"/>

in my app's web.config file. This connection is then used by a custom
membership provider for the create user wizard. Now when I try to create a
new user in the wizard I get the following error;

System.Data.SqlClient.SqlException: Cannot open database "aspnetdb"
requested by the login. The login failed.
Login failed for user 'MYSERVER\ASPNET'.

I was able to work fine when the db was on sql express. What is the
problem
and how can I fix it?

Thanks

Regards

Dec 18 '05 #2
On Sun, 18 Dec 2005 12:39:20 -0000, "John" <Jo**@nospam.infovis.co.uk> wrote:

¤ Hi
¤
¤ I am manually able to create a connection to my db in the vs2005 ide using
¤ Tools->Connect to Database. In the connection I see 'Data
¤ Source=MYSERVER;Initial Catalog=aspnetdb;Integrated Security=True' as the
¤ connection string and 'NET Framework Data Provider for SQL Server' as the
¤ provider. Following these settings in my code and I have used the connection
¤ string;
¤
¤ <add name="Membership" connectionString="Data Source=MYSERVER;Initial
¤ Catalog=aspnetdb;Integrated Security=True"
¤ providerName="System.Data.SqlClient"/>
¤
¤ in my app's web.config file. This connection is then used by a custom
¤ membership provider for the create user wizard. Now when I try to create a
¤ new user in the wizard I get the following error;
¤
¤ System.Data.SqlClient.SqlException: Cannot open database "aspnetdb"
¤ requested by the login. The login failed.
¤ Login failed for user 'MYSERVER\ASPNET'.
¤
¤ I was able to work fine when the db was on sql express. What is the problem
¤ and how can I fix it?
¤

Try enabling impersonation in your web.config. file.

http://msdn.microsoft.com/library/de...ersonation.asp
Paul
~~~~
Microsoft MVP (Visual Basic)
Dec 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mdurliSPAMFILTER | last post by:
Hello, I developed a win32 .exe CGI that connects to a clustered SQLServer to report some data. The software is written with Borland C++Builder. This is the oledb string:...
11
by: Art | last post by:
Hello again, Can anyone tell me the correct connection string to use? My database is on the E: drive of a remote server. I can either map a drive from my local machine to it, or use the...
2
by: MasterChief | last post by:
I have a OLEDB Connection String that is working very well for me. My question is that I read that you can store the Connection String in a seperate include file or somewhere else. I am just...
3
by: DavideR | last post by:
I'm working with vs2005 (vb.net) i need to detach a database autoclose property is set to true close cursor on commit is set to true i use the sp_detach with adodb (the program has been converted...
2
by: hfk0 | last post by:
Hi, I have a simple asp.net application running ok on my WinXP development server with SQL Server Express 2005 installed locally. After moving to the live server (Win 2000 server with MSDE 2000...
10
by: cleo | last post by:
I am migrating from VB6/Access to Visual Basic and SQL Express. I have success writing test code on my local machine and am now setting up tests for deployment to a server. I have installed SQL...
0
by: TG | last post by:
Hi! Once again I have hit a brick wall here. I have a combobox in which the user types the server name and then clicks on button 'CONNECT' to populate the next combobox which contains all the...
2
by: TG | last post by:
Hi! Once again I have hit a brick wall here. I have a combobox in which the user types the server name and then clicks on button 'CONNECT' to populate the next combobox which contains all the...
8
by: K Viltersten | last post by:
I'm getting "connection not initialized" for error when running the following code. string conStr = "Persist Security Info=True;" + "User ID=sa;Password=passpass;" + "Initial...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.