Showing posts with label connects. Show all posts
Showing posts with label connects. Show all posts

Wednesday, March 21, 2012

I cant connect to a domain account! HELP!

Hi

Doing webforms in ASP.NET and i have a connection string in the webconfig that connects to a locally created SQL Server user account.

This is fine however when i try to connect to a domain account created by the IT administrator for me, it wont work.

The User name and password he supplied are correct as i logged into my PC (Win 2000) using it to test it. However when i try to connect to this remote network domain account by changing my connection string it fails... anyone any ideas, or am i missing a subtlety of ASP.NET and SQL connectionstrings?

Heres the connection string that works...
ConnectionString = value="Server=MY-SERVER;Network Library=DBMSSOCN;Initial Catalog=MYDATABASE2;User ID=MrLocalUser;Password=password;"

Heres the connection string that fails...
ConnectionString = value="Server=MY-SERVER;Network Library=DBMSSOCN;Initial Catalog=MYDATABASE2;User ID=DOMAIN\MrDomainUser;Password=password;"

??I'm not convinved that you can connect to a Sql Server using a windows account without using integrated security. Basically there are two type of authentication for SQL Server, "SQL Server" where you pass a username and password & "Window Integrated" where it passes the identity that the application is running. A connection string for this would be something like this:

ConectionString = "Server=MY-SERVER;Network Library=DBMSSOCN;Initial Catalog=MYDATABASE2;Integrated Security=SSPI"

So if you are running your ASP.NET application under the default user, the credentials passed would be:
[localmachine]\ASPNET

If you want to get it connect to the database using that specific account, you have a couple of options.

1) Change the identity that the asp.net application runs under. You can do this in the web.config file (i.e. to allow you to specify the specific user that the application runs under)

2) Switch on Impersonation, and have it run under the identity of the person logged into the application.

These both start to get a bit more involved, as it means you will need to ensure that the user that the process is running under has the appropriate permissions throughout the application, and also within the Framework folders.

Here's some info on Impersonation:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetimpersonation.asp

Here's some further reading on changig the Asp.Net identity:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsent7/html/vxconApplicationIdentity.asp

Hope this helps

Regards

Darren

MCSD.net

Monday, March 19, 2012

I cannot get Enterprise Manager to remotely connect!

I have an ASP page that is pulling data from an SQL server 2000 database. The code connects just fine using the specified Username and Password which was set up by the admin.

However, using that same username and password, I cannot get connected using Enterprise Manager SQL registration method so I can change database settings.

The error message I get says: SQL server does not exist or access denied (Conection Open(connect)).

The SQL server does exist (because it finds it in the server list). For some reason I am getting access denied. The server is running a mixed authentication mode.if sql2000 is running on win2003,it must be fix by sql service pack .
then you can settle the problem.|||I am trying to connec to a machine running win2000.|||Are you registering by machine name or ip address ? Can you ping the server ? When you say remotely - please provide more details on this ?|||Remotely means outside the firewall. I have also tried to connect inside the firewall. Inside the firewall, the server is listed by name in the available servers list when registering a new server. It just won't connect. Outside the firewall I am typing the IP in and nothing. SQL server is running on the webserver I am working off of.|||Can you ping the sql server (from inside or outside) ? Did you try using the ip address when registering from inside/outside ? What does your client network utility show as far as enabled protocols ? What are the errors you receive inside/outside ? Are you using the same machine to connect in both example (inside/outside) ?|||Also, since a firewall is involved - validate that the sql port is open. The default/normal port is 1433, but might have been changed by the sa/dba for security.