Community discussion forum

Error while trying to connect to SQL Server 2000 database

  • 1 year ago

    I'm writing some code for a web application using ASP.Net with VB.Net behind it..

    And i'm using a SqlConnection control to open connection with the SqlServer 2000 database.

    In the SqlConnection i set the ConnectionString property to

    SqlConnection.ConnectionString = "workstation id=WAWAN;packet size=4096;integrated security=SSPI;initial catalog=DBPart;persist security info=False"

    But when i call SqlConnection.Open method, it raise an error message like this

    "Login failed for user 'WAWAN\ASPNET'"

    "Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'WAWAN\ASPNET'"

     

    The strange thing is when i used that ConnectionString to open the database connection in a Windows Application, it runs smoothly, no error raised.

    Even when i'm executing an Sql Query with a SqlCommand control, it's just ok, no error raised to..

     

    So, is there something i forgot? or something is missing? or any other reason??

    Please help..

    Thanks before.

    Wawan (Daud) 

  • 1 year ago

    First, not the answer... I just wanted you to take a look at this for correct syntax of your connection strings, that's always the first place to look...

    http://www.connectionstrings.com

    The answer you seek is actually fairly complex.

    You are running into what is called the "double-hop" issue. It's been common for many years.

    The problem is that you're using a Client / Server type application. The client being IE the server running on a different machine.

    You are using integrated security=sspi in your connection string. So you are asking the application to authenticate as the current windows identity to your SQL server.

    I imagine your SQL server is on a different machine, that's why you can't authenticate. This is the "double-hop" issue.

    There are two choices you can make to fix the problem...

    1) You can provide a SQL user account name and password in your connection string (and not use integrated security option).

    2) If you are using Windows 2003 IIS6, you can configure the Process Idenity to be a domain account, that has access to both computers, and is configured for access on your SQL server database as well. This method is explained here: http://msdn2.microsoft.com/en-us/library/ms998297.aspx

    If you're using Win 2000, you'll have to configure Delegation for the user(s) authenticating. That is actually very difficult task. I do not recommend it. (many problems can occur if it's not done right, and it also opens a security hole)

    Hope I've been some help to you. Good luck.

  • 1 year ago

    OK, Thanks for your attention..

    I've found the problem, it caused by the installation setting of the SQL Server 2000.

    I had set "Windows Authentication mode" while installation. When i try to reinstall the SQL Server with "Mixed Mode (SQL Server & Windows Authentication" it can run smoothly.. no error raised when i'm running my program..

     

    Thanks a lot.

    Daud.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!