January 7, 2005 at 11:36 am
hi..........
i m facing a problem in opening the sql connection to the sql server database..i have written following code in dotnet web application. string constring= ConfigurationSettings.AppSettings["connstring"]; SqlConnection sqlcon=new SqlConnection(constring); sqlcon.Open();
while connstring is set to........ "data source=6-1;initial catalog=CVSystem;user ID=admin;Password=star;Trusted_Connection=False"
i had tried by creating different users in my sql server......but didn't work..plz guid me in following exception and tell me which steps should be taken
exception is
Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'admin'. Reason: Not associated with a trusted SQL Server connection
January 7, 2005 at 1:36 pm
Is the SQL Server set to only accept Windows authentication? You can check this through Enterprise Manager.
- right-click on the server name
- choose Properties
- click on the Security tab
- look at the Authentication setting
If it says Windows only, you must use a Windows user account or change the setting in SQL Server and restart the SQL Server.
K. Brian Kelley
@kbriankelley
January 7, 2005 at 10:31 pm
thanx yah that was windows authentication mode......but problem is still there as i use windows authentication mode and windows user account as use following connection string but it is giving me following error now.....
"workstation id=FITFD10;packet size=4096;integrated security=SSPI;data source=6-1;persist security info=False;initial catalog=CVSystem"
and
"workstation id=FITFD10;packet size=4096;integrated security=SSPI;data source=fitfd10;persist security info=False;initial catalog=CVSystem;User id=6-1/administrator;Password=password"
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 'FITFD10\ASPNET'.
Source Error:
i just change sql server settings and bring it in sql server and windows authentication mode..but problem is still there............can u tell me exact connection settings and sql server security setting........or reason for current problem.............thanx in advance.....
January 8, 2005 at 1:07 am
If your SQL Server is on a different server, you're left with a few options. The two most common choices:
1) Change SQL Server to allow mixed mode and go back to the original connection string.
2) Modify the account the the ASP.NET application runs under to be a domain account which has privileges in SQL Server. You may need to get with your domain administrator in order to identify such an account.
If the web server and SQL Server are on two different servers, the reason the ASPNET account is failing is because it is only recognized by the web server. That's because the account is a local account, meaning local to that server only. A different computer won't recognize the account.
If the web server and SQL Server are on the same server, you've probably not granted access for the ASPNET account to login to SQL Server, much less give it access to the appropriate database. In Enterprise Manager, in the security tab, you can add a windows login by specifying the name that you're getting as failing (FITFD10\ASPNET).
For a bit more information:
How to implement impersonation in an ASP.NET application (306158)
K. Brian Kelley
@kbriankelley
January 8, 2005 at 4:16 am
once again thanx kelley!......i have done all u said......my iis and sql server is on same pc......but its not adding window login account fitfd10/ASPNET i tried much more by changing spelling etc etc......but sql server saying
bad username or password
so wht to do now........till that time i have worked with MSAcess..this is my first chance to work with sql server........plz guid..............
January 8, 2005 at 7:31 am
Try adding fitfd10\aspnet (notice the difference in the slash).
K. Brian Kelley
@kbriankelley
January 8, 2005 at 11:05 am
Yah Kelley but that was 1 of my different tries..i have tried with that fitfd10\ASPNET slash also..
same error:
bad username of password...
infact i have 2 different computer with 2 different sql servers editions....
1 computer "6-1" with sql server desktop edition and 2nd computer "fitfd10" with sql server enterprise edition.................
trying on bother server...
here on 6-1 while trying 6-1\aspnet its giving the error
"user has not granted the requested login type on this computer........... "
i just go to the control panel/useraccounts and make the aspnet account administrator, it was limited before. but continue with the same error...
okz telll me about other way...sql server accounts.. i don't want to use 6-1\aspnet or fitfd10\aspnet.....as its not working
telll me about sql server login authentication how can i use it..what are settings to made and wht is connection string in asp.net.......thanx in adance.....and thanx u r giving me much more time and much earlier replies.............
January 8, 2005 at 11:51 am
Thanx Thanx Kelley.......
just got it...i was adding aspnet account on wrong place....i just add it in databases/CVSystem/ users.......... and its working now...........although it is still in window only mode and same connection string
"workstation id=6-1;packet size=4096;integrated security=SSPI;data source=6-1;persist security info=False;initial catalog=CVSystem"
well don't know how it is working but it working
okzz thanx for ur help and guidness....send me link to study the security features of sql server and about that login type.....
hope u will guid me next time also.........thanx in advance
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply