Hello every body.
I'm trying to connect my asp.net website with SQL server 2005 database. I have two copies of my site. One in File system and other one in local IIS. When I try to connect website in file system it is OK. But I am unable to connect my site when it is created in IIS. An error message says "Login Failed". Can some one help me please.

Recommended Answers

All 6 Replies

hi..

Check for the ConnectionString.if the path of the database is of you file system, then copy your database into your directory in IIS.and thne you need to change the ConnectionString.

Hope this will help.

Thanks.

Hi thilinam,

Post your connection string details.

It seems that your connection string uses Windows Authentication.

When you run your web application using file system in Visual Studio, It will connect using your NT account so that you may be able to connect with database (if your connection string uses Windows Authentication). If run your application from IIS, it will use ASPNET account. Therefore your application cannot connect with database with ASPNET account.

Try to use SQL authentication to connect with database. For example,

<connectionStrings>
 <add name="ConnectionString"  connectionString="Server=YourServerName;Database=YourDatabaseName;User Id=SomeSQLUserId;Password=SomePassword" providerName="System.Data.SqlClient"/>
</connectionStrings>

Hi,
Thanks for helping me..
I'm using widows authentication
here is the connection string.

"Data Source=WS4001\sqlexpress;Initial Catalog=tempdb;Integrated Security=True"

I tried to use sql authentication. But I'm unable to connect database. How can I find the user name which associated with trusted sql server.
please help me
Thanks.

Why are you trying to connect with tempdb.

The tempdb is system database and is used to hold the following: Temporary user objects that are explicitly created, such as: global or local temporary tables, temporary stored procedures, table variables, or cursors.

Create your own database and connect your asp.net application with it.

You can find the logins associated with your SQL server instance using SQL Server Management Studio. It will be displayed under Server Name->Security->Logins.

You can also retrieve the user login details using the following SELECT statement from 'master' database.

SELECT * FROM SYSLOGINS

Hi,
Thanks for helping me..
I'm using widows authentication
here is the connection string.

"Data Source=WS4001\sqlexpress;Initial Catalog=tempdb;Integrated Security=True"

I tried to use sql authentication. But I'm unable to connect database. How can I find the user name which associated with trusted sql server.
please help me
Thanks.

I think your using a "MIXED" SQL server Autentication.. normally the Default user name and password is (username : Sa password: admin)

<connectionStrings>
<add name="TROFIR_ConnectionString" connectionString="Data Source=Localhost\SQLEXPRESS;Initial Catalog="Dbase Name";User ID=sa;Password=admin" providerName="System.Data.SqlClient"/>
</connectionStrings>

Thank you verymuch Ramesh S,
Sorry for the late. I couldn't report you about my progress.

I've created my own database. and tried to connect it with my application using sql authentication. But it can't identify my user name as a trusted user. I used a user name which is stored in SYSLOGINS. but it doesn't work. how can I overcome this. Please help me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.