Monday, March 19, 2012

Login failed for ".

What am I missing? Computer A is windows xp sp2 with visual studio 2005. Computer B is Server2003 with SQLServer2005.

Computer A: local website directory security configured for anonymous access using a local user computer_A\username and password. The password is NOT managed by iIIS.

Computer B: SQLServer2005 allows local and remote connections, sql server and windows authentication. Local user computer_B\username and password is defined.

User computer_B\username is defined in the sql server security logins with login properties allowing access to database mydb. The default scheama db_owner. The database (mydb) properties/permissions/effective permissions are Authenticate, connect, delete,execute,insert,select and update.

The webconfig file has a connection string defined as:Name=LocalSqlServer Connection String=Data Source=server.domain-name,1433;Initial Catalog=mydb;Integrated Security=True;. The webconfig file contains <remove name="LocalSqlServer" and then an <add name="LocalSqlServer" with the above information. The webconfig file also has <identity impersonate="true" /> and <authentication mode="Forms">
<forms name=".ASPXFORMSAUTH" loginUrl="login.aspx" protection="Validation"/>
</authentication>
<authorization>
<deny users="?"/>
<allow users="*"/>
</authorization>

My login page manually reads a table called usrTbl via a stored proceedure to check for the existance of the username and password presented.(Yes I know it is in the clear-bad bad me, just bear with me for the problem). It then formsredirectfromlogin to the original requested page whice is Default.aspx.

Default.aspx has a gridview defined. The datasource is defined in the page load event as:

gridview1.datasource = membership.getallusers()

gridview1.databind()

I get an error Login failed for ". User not associated with a trusted connection

How can that be, the database has been access earlier with the same connection string. I checked to make sure user computer_B\username can log on to computer B.

Please help me to understand a solution to this

You may hit the same issue discussed in the following thread:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=285649&SiteID=1

Thanks
Laurentiu

|||

Not the same thing. I know my post was long, but i needed to provide the complete environment.

Failure is with different tables in the same database. I guess I failde to say the membership tables were created in the same database. Bottom Line Here.

Read database table fine, redirect to different page, failure reading same database.

WHY

|||

Pasting answer from usenet forum:

Hi Bill,

Welcome to use MSDN Managed Newsgroup Support.

From your description, my understanding is that, you can not config a web
application to connect to the remote SQL Server instance. If I
misunderstood your concern, please feel free to point it out.

Please use the following entry for the <identity> in web.config.

<identity impersonate="true" userName="computer_b\username"
password="password" />

Since you impersonated in your web application but you did not give a
credential to the application, so that, it will use the IIS account to
connect to the SQL Server. Of cause this will cause the login error.

Hope this will be helpful.

Sincerely,

Wei Lu
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

No comments:

Post a Comment