Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 4th, 2004, 11:06 AM
Registered User
 
Join Date: Apr 2004
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL Server / Login failed for user 'NT AUTHORITY

In trying to set up the SQL/Server examples from the Wrox Beginning ASP book I am getting the error below. Originally I recieved errors with the connection strings, but then got that, I think, corrected, or at least changed errors, and now am faced with this one.

Any ideas?

Thanks

---------------------------------------------------------------------

The error occurs on the open method of the connection object, and displays as:

Server Error in '/students' Application.
----------------------------------------------------------------------

ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITY\LOCAL SERVICE'. ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITY\LOCAL SERVICE'.
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.Odbc.OdbcException: ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITY\LOCAL SERVICE'. ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITY\LOCAL SERVICE'.



My DSN as setup in the web.config file (password is masked out):



<configuration>
    <system.web>
        <customErrors mode="Off"/>
    <compilation debug="true"/>
        <webServices>
        <protocols>
            <add name="HttpGet"/>
            <add name="HttpPost"/>
        </protocols>
    </webServices>
    </system.web>
  <appSettings>
    <add key="NWind"
         value="Initial Catalog=NWind;UID=StudentSQL;Password=XXXXXXXX;DAT ABASE=Northwind;" />
    <add key="NWindDSN"
    value="DSN=NWind;UID=StudentSQL;PWD=XXXXXXXX;DATAB ASE=Northwind;" />
  </appSettings>
</configuration>
*******

The code (pretty much directly from the Wrox Beginning ASP Databases) is copied below:

<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.Data.Odbc" %>

<html>
  <head></head>
  <body>
    <h4>First Example: Listing data from the Employees table</h4>
    <asp:DataGrid id="dgNameList"
     ... ... ...
     />
  <body>
</html>

<script language="VB" runat="server">
Sub Page_Load(Source As Object, E As EventArgs)
    Dim oODBCConnection As OdbcConnection
    Dim sConnString As String = ConfigurationSettings.AppSettings("NWindDSN")
    oODBCConnection = New OdbcConnection(sConnString)
    oODBCConnection.Open()
    Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
                           "FROM Employees;"
    Dim objCommand As New ODBCCommand(strSQL, oODBCConnection)

   Response.Write("ServerVersion: " & _
             oODBCConnection.ServerVersion & _
             vbCRLF & "Datasource: " & oODBCConnection.DataSource & _
             vbCRLF & "Database: " & oODBCConnection.Database)

   dgNameList.DataSource = objCommand.ExecuteReader()
   dgNameList.DataBind()
   oODBCConnection.Close()
End Sub
</script>


  #2 (permalink)  
Old November 5th, 2004, 02:39 AM
Friend of Wrox
 
Join Date: May 2003
Location: Delhi, Delhi, India.
Posts: 230
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Check your SQL Server authentication properties, it might be in windows authentication only mode. If so try to change that in Mixed mode and run the code again.

Charul Shukla
  #3 (permalink)  
Old November 14th, 2004, 10:03 AM
Authorized User
 
Join Date: Jul 2004
Location: Bandar Seri Begawan, Brunei-Muara, Brunei.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

>>The code (pretty much directly from the Wrox Beginning ASP Databases) is copied below:

<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.Data.Odbc" %>

<html>
  <head></head>
  <body>
    <h4>First Example: Listing data from the Employees table</h4>
    <asp:DataGrid id="dgNameList"
     ... ... ...
     />
  <body>
</html>

<script language="VB" runat="server">
Sub Page_Load(Source As Object, E As EventArgs)
    Dim oODBCConnection As OdbcConnection
    Dim sConnString As String = ConfigurationSettings.AppSettings("NWindDSN")
    oODBCConnection = New OdbcConnection(sConnString)
    oODBCConnection.Open()
    Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
                           "FROM Employees;"
    Dim objCommand As New ODBCCommand(strSQL, oODBCConnection)

   Response.Write("ServerVersion: " & _
             oODBCConnection.ServerVersion & _
             vbCRLF & "Datasource: " & oODBCConnection.DataSource & _
             vbCRLF & "Database: " & oODBCConnection.Database)

   dgNameList.DataSource = objCommand.ExecuteReader()
   dgNameList.DataBind()
   oODBCConnection.Close()
End Sub
</script>>>>

This code above is working fine, I'm using this as a pattern when I started out. That login failure was in your SQL Server authentication. It could be the user has no permission to access/logon to the northwind database. Try to check properties of your sql server if your using the right authentication method.




jrd


Similar Threads
Thread Thread Starter Forum Replies Last Post
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGO hexOffender ASP.NET 1.0 and 1.1 Basics 2 October 24th, 2008 07:26 AM
failed for user 'NT AUTHORITY\NETWORK SERVICE' GS ASP.NET 2.0 Professional 5 March 26th, 2007 05:16 AM
Login failed for user 'NT INSTANS\NETWORK SERVICE' keysersoze BOOK: ASP.NET Website Programming Problem-Design-Solution 3 April 6th, 2005 01:25 PM
login failed for user nt authority\anonymous login rj1406 Classic ASP Databases 1 October 24th, 2004 09:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.