|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How many times have we seen this error exception?
System.Data.SqlClient.SqlException: Login failed for user '<MY COMPUTER>\ASPNET'. at System.Data.SqlClient.ConnectionPool.GetConnection (Boolean& isInTransaction) at System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnectionString options, Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open() at <MY WEB PAGE>.Page_Load(Object sender, EventArgs e) in <MY SOURCE>.ascx.cs:line 26 SqlConnection conn = new SqlConnection("user id=<login>;pwd=<password>;server=<MY COMPUTER>\\vsdotnet;integrated security=SSPI;initial catalog=<DB>;"); line 26: conn.Open(); I've tried various connection strings. o user id=sa;pwd=; o Trusted_Connection=yes; I have configured SQL server to accept both Windows and SQL logins. I have even succesfully connected via SQL Query Analyzer with the same login I used in my connection string. So I know the SQL server appears to be configured correctly. I also created a ODBC System DNS to my SQL server if that can be used somehow. I was able to get my PHPbb forum to connect via ODBC succesfully this way. What is the initial catalog anyhow? I gave it the name of the Database I wish to access a table within. All I want to do is display a table from my SQL database and allow the web user to sort the various columns in the table. Any good example pointers you might have to perform this task? I am pretty new to all this so think easy newbie stuff.... Thanks for any help. |
|
#2
|
|||
|
|||
|
Bah, I got it....
In my searching I learned a bit more too. I found it better to put the connection string in the Web.config file. A buddy of mine was confused why I had two slashes in the server name. Because he uses VB where I use C# so I put the connection string in the Web.config and only need one slash then. Also, it is a bit more secure then. <configuration> <!-- application specific settings --> <appSettings> <add key="connString" value="user id=sa;pwd=;server=<serverName>\VSdotNET;integrated security=SSPI;trusted_connection=true;initial catalog=<Database>;" /> </appSettings> .... In C# access looks like this.... SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["connString"]); try { conn.Open(); ... But, that still doesn't solve any login failures I had.... Even though I added my specified login because I wasn't using sa; actually I still am not using sa I setup another login. I thought I could just have it but you need to allow ASPNET to login too. Anyhow, here's how.... Microsoft sql server -> enterprise manager. Microsoft SQL Server SQL Server Group serverName\VSDOTNET (Windows NT) Security Logins <right click> New Login Name <click ....> scrolll down to the ASPNET (aspnet wp account) You can set default database if you wish here too. After that I went to the specific database I was interested in and set permissions to allow the various database commands. and finally I was good to go..... Hope that helps anyone with similar issues. I know I struggled to find good explanations since there are so many different reasons for this same error. I heard there was a FAQ out there for this common error but I never did find it. If someone knows where be nice to add the link to the FAQ in a reply. Last edited by Sloper : December 8th, 2003 at 04:05 PM. |
|
#3
|
|||
|
|||
|
Many Many thanks!!! That solution:
Code:
Microsoft sql server -> enterprise manager. Microsoft SQL Server SQL Server Group serverName\VSDOTNET (Windows NT) Security Logins <right click> New Login Name <click ....> scrolll down to the ASPNET (aspnet wp account) You can set default database if you wish here too. was just what I was looking for... URL |
|
#4
|
|||
|
|||
|
I'm quickly finding that in order to develop DB accessed Web Apps in VSDOTNET that you
need to know a lot more about SQL Server than just how to install it on a machine, build tables, stored procedures, SELECT queries, etc. This place seems to have gotten me through two hang ups already today. Thanks SLOPER! Microsoft SQL Server SQL Server Group serverName\VSDOTNET (Windows NT) Security Logins <right click> New Login Name <click ....> scrolll down to the ASPNET (aspnet wp account) |
|
#5
|
|||
|
|||
|
Cant find the ASPNET account
Quote:
Hey guys, I followed your instructions and cannot find the ASPNET account when I click the new user and scroll through the list. I have .NET installed. Do I have to create the ASPNET account in Active Directory first? Thanks, Chris |
|
#6
|
|||
|
|||
|
Solution to Login Failed !
Quote:
You don't know how much this helped me. I was working on my first web form project and was about to give up when I stumbled across your solution. Thank you, thank you ! This gave me the confidence to push through other similar road blocks until I finished the project. Cheers. Kathy ![]() |
|
#7
|
||||
|
||||
|
Hi Kathy,
welcome to the forum ![]() I just want to say, weldone for searching the forum first before asking questions that have been answered before! Glad your application is finished and working, you know where to find us if you need any further help ![]() Cheers noFriends
__________________
Look! Its a ShemZilla ![]() ![]()
|
|
#8
|
|||
|
|||
|
System.Data.SqlClient.SqlException: Login failed for user 'ServerName\SKNET81$'.
Hello,
I am new to this forum .. I have tried the way you explained but it didn't work for me.I am using ASP.NET 2.0 membership APIs to build login system with MS SQL 2000. The site is accessable using username and password. The system is working fine on my local machine but when i deployed on the site it has started giving error like -------------------- System.Data.SqlClient.SqlException: Login failed for user 'ServerName\SKNET81$'. ---------------- I was wondering why this error comes even tough i dont have any database user with name "ServerName\SKNET81$". I have searched through the net but couldn't find the proper answer that could solve my problem. Please help or refer me to proper place for solution. With Best Regards Iffi |
|
#9
|
|||
|
|||
|
Quote:
Asalam o Alikum , For this problem i sujjest you to , create the acount of the same name and grant access to it, definiting some spacific domain ..... insallah it works |
|
#10
|
||||
|
||||
|
as you can see, this thread has been solved, and over a year old,
please don't post in threads like this ![]() |
|
#11
|
|||
|
|||
|
aspnet account on winxp
i can not find the aspnet account
i am using windows xp sp2, with vs 2005, and framework 2.0 what to do? |
|
#12
|
||||
|
||||
|
as you can see to the previous post of mine, please
dont post in old threads, if you have a problem, create a new thread and post your problem with the code you are using. |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > System.Data.SqlClient.SqlException: Login failed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|