i having a problem with my website i cannot login via my connection string i get a error say:
==================================================================
Login failed for user ";. The user is not associated with a trusted SQL Server connection.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user ''. The user is not associated with a trusted SQL Server connection.

Source Error:
Line 74:
Line 75: objConnection = New SqlConnection("Data Source=196.220.41.58,1444;Initial Catalog=Matlatladb;Integrated Security=SSPI;User ID=matlala;Password=m@t007;")
Line 76: objConnection.Open()
==================================================================

I asked the company that is hosting my website to change the Authentication to "Windows Authentication Mode (Windows Authentication)" to "Mixed Mode (Windows Authentication and SQL Server Authentication)".
but they told me that they cannot do that since the it will affect other websites on their server.

My question is: Is there a way to get around this, using web config file?

Hi Ramo

Just try these steps..
1. If you are using a sql-server database, open enterprise manager. (The enterprise manager will be available within the sqlserver program group in windows. Start->Programs->Microsoft SQL Server->enterprise manager)

2. In the ( database window ( left pane ) locate your database and expand. You will see tables, view, users etc listed below. Dblclick the users icon. On the right pane dblclick the machiname\ASPNET user you had created earlier. This will open up the "database user properties" window. You will see that the database role "public" is already selected.

3. Now additionally select the db_datareader role as well. Click apply.

This will give the database read permission to the ASPNET user and hopefully fix your problem.

Hi Vizy
thanks for the respond!!

The thing is that i am hosting with a certain company so i cant access the server in order to do the above steps but i while try and tell them to do that for me....and see if that helps.

Thankx

Ask your host the format of the connectionstring you need to use to connect to your database.
You might have to create a user using their DB management feature.

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.