I'm building a Windows Service which keeps getting denied access to SQL Server 2k. The Service operates as a System User rather than an individual user profile.
I've tried Trusted_Connection=yes and Integrated Security=SSPI but these are both denied.
Any ideas what the connection string to connect to SQL Server 2k from a Wndows Service is?
I am getting the error: Cannot open database "aspnetdb" requested by the login. The login failed. When I browse to my ASP.NET 3.5 LINQ web application on the IIS 6.0 server on Server 2003. I imagine this is because while I granted SQL Server 2005 login and permissions to my database that the application stores its data in, I did NOT grant any rights to the service account the IIS Application Pool uses for its identity to the aspnetdb database on SQL Server which is where all my roles information is stored at. My question is what are the MINIMUM permissions needed for this database so it can perform its roles related functions? I'm using Windows Authentications with the SQL Role provider for authorization.
Thank you.
EDIT: I think I only need to open the aspnetdb database and add my login to the aspnet_Roles_FullAccess role. Is that correct?
I am trying to connect SQL database through code but I get this error,I have spent days to solve it but unfortunately I couldn't...Here is my code in VB express(OP:windows 2000 with SP4)I am new to VB,so it makes the situation more difficult for me.
my code is:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim conn1 As SqlConnection = _
New SqlConnection("Data Source=.SQLEXPRESS;" & _
"Integrated Security=SSPI;" & _
"database=deneme3_database;")
'Open connection
conn1.Open()
MessageBox.Show("Connection succeeded.")
'Close connection
conn1.Close()
MessageBox.Show("Connection closed.")
End Sub
The error message is,it is in german but it is clear I guess:)
" Die von der Anmeldung angeforderte "deneme3_database"-Datenbank kann nicht geöffnet werden. Fehler bei der Anmeldung. Fehler bei der Anmeldung für den Benutzer 'ADPLANatalay'. "
I'm working on an ASP.NET project, and we're attempting to switch from SQL Server authentication to Windows authentication to connect to the database. It works fine locally when I debug in Visual Studio, but when it hits the web server, I get the error: "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection." IIS has anonymous access disabled, and Integrated Windows Authentication is checked. The web.config file has: <authentication mode="Windows"/><identity impersonate="true"/> The database I'm attempting to access is on a different machine than IIS, and the connection string doesn't contain a username or password, and has "Trusted_Connection=Yes", and "Integrated Security=SSPI". From what I've been able to find online, I'm guessing the problem is due to IIS and SQL Server residing on different machines, but I'm not sure how to fix it. Any ideas?
I have been struggling with this problem for a while with SQL 2005. I have never had such login problem with SQL 2000. Here is the scenario:
I have installed SQL2005 standard version on a XP Pro box and I am trying to access it from another XP Pro machine. I can access it using a SQL user name and password that I set up on the server, but I have not had luck with using Windows NT Integrated security. When I try to connect to it (e.g. by a UDL file), I get an error saying Login failed for user €˜HP-AMD64Guest€™ where €˜HP-AMD64€™ is the name of the PC running the SQL 2005. I can access the files on the machine without any problem. I do not understand why it uses €˜Guest€™ that is not what I use to log on my machine. Does anyone have any clue to offer me?
I just installed the Issue Tracker using .net 1.1 (on my computer). When I try to log in via the login page, I get:
Login failed for user 'NT AUTHORITYLOCAL SERVICE' Here is my stack trace info: SqlException: Login failed for user 'NT AUTHORITYLOCAL SERVICE'.] System.Data.SqlClient.ConnectionPool.CreateConnection() +402 System.Data.SqlClient.ConnectionPool.UserCreateRequest() +151 System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +386 System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372 System.Data.SqlClient.SqlConnection.Open() +384 ASPNET.StarterKit.IssueTracker.DataAccessLayer.SQLDataAccessLayer.ExecuteScalarCmd(SqlCommand sqlCmd) +129 ASPNET.StarterKit.IssueTracker.DataAccessLayer.SQLDataAccessLayer.Authenticate(String username, String password) +184 ASPNET.StarterKit.IssueTracker.BusinessLogicLayer.ITUser.Authenticate(String username, String password) +44 ASPNET.StarterKit.IssueTracker.DesktopDefault.Login(Object s, EventArgs e) +84 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain() +1292
I have added everyone, asp.net, local service, network service - all full control on the entire folder. Restarted IIS - still can't log in. Please help.
I have built a web page in visual web developer express and I moved it over to use IIS. I gave NT AUTHORITYNETWORK SERVICE read and write permissions to the folder and included it in my IIS virtual folder. I can see the login page just fine. I can create a user just fine. I can even access the forgot password page just fine. But if I try to login in I get this stack trace. I can't figure out what more I need to do for NT AUTHORITYNETWORK SERVICE. Can any one help.Server Error in '/' Application. Cannot open user default database. Login failed.Login failed for user 'NT AUTHORITYNETWORK 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.SqlClient.SqlException: Cannot open user default database. Login failed.Login failed for user 'NT AUTHORITYNETWORK SERVICE'.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SqlException (0x80131904): Cannot open user default database. Login failed. Login failed for user 'NT AUTHORITYNETWORK SERVICE'.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735043 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +33 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105 System.Data.SqlClient.SqlConnection.Open() +111 System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +84 System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +197 System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +1121 System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105 System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42 System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +83 System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +160 System.Web.UI.WebControls.Login.AttemptLogin() +105 System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
have built a web page in visual web developer express and I moved it over to use IIS. I gave NT AUTHORITYNETWORK SERVICE read and write permissions to the folder and included it in my IIS virtual folder. I can see the login page just fine. I can create a user just fine. I can even access the forgot password page just fine. But if I try to login in I get this stack trace. I can't figure out what more I need to do for NT AUTHORITYNETWORK SERVICE. Can any one help. Server Error in '/' Application. Cannot open user default database. Login failed.Login failed for user 'NT AUTHORITYNETWORK 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.SqlClient.SqlException: Cannot open user default database. Login failed.Login failed for user 'NT AUTHORITYNETWORK SERVICE'.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SqlException (0x80131904): Cannot open user default database. Login failed. Login failed for user 'NT AUTHORITYNETWORK SERVICE'.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735043 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +33 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105 System.Data.SqlClient.SqlConnection.Open() +111 System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +84 System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +197 System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +1121 System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105 System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42 System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +83 System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +160 System.Web.UI.WebControls.Login.AttemptLogin() +105 System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
Mr :I have proplem with Visual stdio 2003 and Windows2003Enterprise Server , when I developed web applicationusing ASP.Net (VB) that establish connection to SQL Serverdatabase the following error appeared.Server Error in '/WebApplication1' Application.Login failed for user 'NT AUTHORITYNETWORK SERVICE'
Hi! I developed one web application, in that i created some users and roles. When its running from my system, users are getting logged. But the problem is - when I hosted this site on my domain server its giving error like - " System.Data.SqlClient.SqlException: Cannot open user default database. Login failed. Login failed for user 'NT AUTHORITYNETWORK SERVICE' ". Its giving this error when i am trying to login. Is there any thing i am missing with Sqlserver. Please help me! thanks in advance!
I cant seem to deploy a DB to my server. Can anyone actually help with this? I have been goint through lots of different things to get it to work... So far I have added the network service account to SQL Express 2005 through the express managment console I have also given NETWORK SERVICE explicit permissions on the database files themselves. It works great on my dev box. I'm able to login and access my secondary DB but when i try to push the site to my server this is what happens. Any help on this is great -- if you need me to post any more of my code -- no problem This is my exact error: SqlException (0x80131904): Cannot open user default database. Login failed.Login failed for user 'NT AUTHORITYNETWORK SERVICE'.] My web.config file looks like: <!-- Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your application. Use the Website->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in WindowsMicrosoft.NetFrameworkv2.xConfig --> <configuration> <appSettings/> <connectionStrings> <add name="ConnectionString" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|igx-ma.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
</connectionStrings> <system.web> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development.
Visual Basic options: Set strict="true" to disallow all data type conversions where data loss can occur. Set explicit="true" to force declaration of all variables. --> <identity impersonate="true"/> <authentication mode="Forms" /> <authorization> <deny users="?" /> <allow users="*" /> </authorization>
<roleManager enabled="true" />
<compilation debug="true" strict="false" explicit="true"/> <pages> <namespaces> <clear/> <add namespace="System"/> <add namespace="System.Collections"/> <add namespace="System.Collections.Specialized"/> <add namespace="System.Configuration"/> <add namespace="System.Text"/> <add namespace="System.Text.RegularExpressions"/> <add namespace="System.Web"/> <add namespace="System.Web.Caching"/> <add namespace="System.Web.SessionState"/> <add namespace="System.Web.Security"/> <add namespace="System.Web.Profile"/> <add namespace="System.Web.UI"/> <add namespace="System.Web.UI.WebControls"/> <add namespace="System.Web.UI.WebControls.WebParts"/> <add namespace="System.Web.UI.HtmlControls"/> </namespaces> </pages> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace.
OK I know that this topic seems like it has been beaten to death in the forums but I'm still unable to figure out why I'm getting this error. I've added the NT AuthorityNetwork Service to the SQL server and the database that I want to connect to. I've made it the db_owner. Still got the error. I added myself (the account I login with into windows) with the same options as with the NT Authority. Still got error. I'm runnin SQL Server 2005 on my local machine as well as IIS 6. I know that my web.config is correct because I only started getting this error after I reinstalled SQL Server and IIS. I've really run out of ideas of why this is happening. I'm assuming from the error message that it's at the database level but I just don't know where. Here are exerts from my web.config that may help:<connectionStrings> <remove name="database"/><add name="database" connectionString="Data Source=(local);Initial Catalog=TheBugZoo;Integrated Security=True;" providerName="System.Data.SqlClient"/> </connectionStrings><roleManager enabled="true" cacheRolesInCookie="true" cookieName="TBZROLES" defaultProvider="TBZ_RoleProvider"> <providers><add connectionStringName="database" applicationName="/" name="TBZ_RoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> </providers> </roleManager>
Login failed for user 'NT AUTHORITYNETWORK 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.SqlClient.SqlException: Login failed for user 'NT AUTHORITYNETWORK SERVICE'.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
thats my error and my connection is <connectionStrings> <add name="hayatConnectionString" connectionString="Data Source=laptop;Integrated Security=SSPI;Pooling=False;Initial Catalog=hayat" providerName="System.Data.SqlClient"/></connectionStrings> i test the Integrated Security= with true false and sspi and i can't access to database my windows vista and iis7
i face the a problem, Login failed for user 'NT AUTHORITYNETWORK SERVICE'. i already add login permission in SQL management for 'NT AUTHORITYNETWORK SERVICE'. it's not working. The default database shows 'master' as default database. do i need to change to aspnetdb.mdf database?.
Hi All. I'm new to SQL 2005 server so please bare with me. I just recently setup SQL 2005 on a server in my network and created my first database table. As a test I then create a default.aspx page to access my database/table and load some information into a datagrid. When I push the page up to my server and try to view it in a browser I'm getting the following error: Login Failed for user 'NT AUTHORITYNETWORK SERVICE'A server error occured on the current command. Based on the error I assumed it was a permissions issue. So I went back to the server and openned up 'SQL Server Management Studio', opened up the 'database' folder and right-click my database and choose 'Properties' Under 'Properties' I selected the 'Permissions' and then the 'View Server Permissions' link. From the list I select 'NT AUTHORITYNETWORK SERVICE' user. Once selected I see a list of permissions, such as: - Administer bulk operations- Alter any connection- Alter any credential- Alter any database Does anyone know what permission I need to select in order to allow my aspx page to work?
Login failed for user 'NT AUTHORITYNETWORK SERVICE'.
I've just installed Windows Server 2003 and can't get past this. I've changed the <processModel> userName to SYSTEM, I've added ASPNET to the Admin group, other tweaks with reboot but still can get it to work. I'm not sure what the NT AUTHORITY domain is.
QuickStart samples and applications coming with .NET Framework SDK include "A Personalized Portal", "An E-Commerce Storefront", etc. are working properly with no problem.
I downloaded and installed IBuySpy Store and Portal from www.asp.net. While running default.aspx of these samples the following error occurs:
Server Error in '/StoreCS' Application. --------------------------------------------------------------------------------
Login failed for user 'NT AUTHORITYNETWORK 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.SqlClient.SqlException: Login failed for user 'NT AUTHORITYNETWORK SERVICE'.
I use Window server 2003 and Sql server 2000. both run on the same machine. The machine is behind a router. Port 1433 is forwarded.
------------------------loginfailed.aspx go as follows--------------------- <%@ Page Language="vb" runat="server" %> <%@ import Namespace="System.Data" %> <%@ import Namespace="System.Data.SqlClient" %>
<script runat="server"> Sub Page_Load() Dim myConnection As New SqlConnection() myConnection.ConnectionString = "server=localhost; database=pubs;_ Persist Security info=False; Integrated Security=SSPI; Connect Timeout=30" myConnection.Open() End Sub </script> ------------------------------------------------------------------------------
That program generates error message: Login failed for user 'NT AUTHORITYNETWORK SERVICE'.
However, OleDB works fine. relly dont know what has gone wrong.
I've tried to use Windows authentication to connect to database in MS SQL Server 2000, my connection string like below: "server=(local);Initial Catalog=myDatabase;Trusted_Connection=yes" when I run my code, there is an error occur with below message: Login failed for user 'NT AUTHORITYNETWORK SERVICE' My SQL Server is configured as Window authentication. I can't resolve this problem. Please whow me how to do! Thank you very much!
i need some advise with this error.i created a new web project form, added a dataadapter, connection and dataset to a webform. When creating the connection, no errors. Used the query builder to select the necessary tables, also no errors. i competed and built the project, loaded it in a web browser and bang, login failed for user NT AUTHORITYNETWORK SERVICE. it happens at both the workstation and server.system.data.sqlexception: login failed for user 'nt authorityetwork service'.my dev box is an xp pro workstation. the project is stored on a 2003 web server (unc share). i'm working on an intranet project using visual studio 2003 to display data from sql server db. i've set and reversed a number of security settings in sql and iis trying to correct this error, i'm just not getting it. also, prob not closing the connection when this error occurs either; using SqlDataAdapter1, SqlConnection1 and DataSet11any suggestions are greatly appreciated.(webform1.aspx.vb)Imports System.DataImports System.Data.SqlClient Public Class WebForm1 Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Dim configurationAppSettings As System.Configuration.AppSettingsReader = New System.Configuration.AppSettingsReader Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection Me.DataSet11 = New WebApplication_01.DataSet1 CType(Me.DataSet11, System.ComponentModel.ISupportInitialize).BeginInit() ' 'SqlDataAdapter1 ' Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1 Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "ORDERS", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("Record#", "Record#"), New System.Data.Common.DataColumnMapping("Order#", "Order#"), New System.Data.Common.DataColumnMapping("DateOpened", "DateOpened"), New System.Data.Common.DataColumnMapping("DriverName", "DriverName"), New System.Data.Common.DataColumnMapping("Reference", "Reference"), New System.Data.Common.DataColumnMapping("CustomerName", "CustomerName"), New System.Data.Common.DataColumnMapping("StreetAddress", "StreetAddress"), New System.Data.Common.DataColumnMapping("City", "City"), New System.Data.Common.DataColumnMapping("State", "State"), New System.Data.Common.DataColumnMapping("Zip", "Zip"), New System.Data.Common.DataColumnMapping("OrderStatus", "OrderStatus"), New System.Data.Common.DataColumnMapping("OrderNotes", "OrderNotes"), New System.Data.Common.DataColumnMapping("OrderDueBy", "OrderDueBy"), New System.Data.Common.DataColumnMapping("ServiceName", "ServiceName"), New System.Data.Common.DataColumnMapping("LastModified", "LastModified")})}) ' 'SqlSelectCommand1 ' Me.SqlSelectCommand1.CommandText = "SELECT ORDERS.RECID AS Record#, ORDERS.ORDERNUM AS Order#, ORDERS.ORDERDATE AS Da" & _ "teOpened, Users.Name AS DriverName, ORDERS.REFERENCE AS Reference, ORDERS.CLIENT" & _ " AS CustomerName, ORDERS.ADDRESS AS StreetAddress, ORDERS.CITY AS City, ORDERS.S" & _ "TATE AS State, ORDERS.ZIPCODE AS Zip, ORDERS.STATUSID AS OrderStatus, ORDERS.NOT" & _ "ES AS OrderNotes, ORDERS.DUEBY AS OrderDueBy, SERVICES.NAME AS ServiceName, ORDE" & _ "RS.ModifyTime AS LastModified FROM ORDERS INNER JOIN Users ON ORDERS.USERID = Us" & _ "ers.UserID INNER JOIN SERVICES ON ORDERS.SERVICEID = SERVICES.ID WHERE (ORDERS.S" & _ "TATUSID = 4)" Me.SqlSelectCommand1.Connection = Me.SqlConnection1 ' 'SqlConnection1 ' Me.SqlConnection1.ConnectionString = CType(configurationAppSettings.GetValue("SqlConnection1.ConnectionString", GetType(System.String)), String) ' 'DataSet11 ' Me.DataSet11.DataSetName = "DataSet1" Me.DataSet11.Locale = New System.Globalization.CultureInfo("en-US") CType(Me.DataSet11, System.ComponentModel.ISupportInitialize).EndInit() End Sub Protected WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection Protected WithEvents DataSet11 As WebApplication_01.DataSet1 Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here SqlDataAdapter1.Fill(DataSet11) DataGrid1.DataBind() End Sub Private Sub DataGrid1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid1.SelectedIndexChanged End Sub Private Sub SqlDataAdapter1_RowUpdated(ByVal sender As System.Object, ByVal e As System.Data.SqlClient.SqlRowUpdatedEventArgs) Handles SqlDataAdapter1.RowUpdated End Sub Private Sub SqlConnection1_InfoMessage(ByVal sender As System.Object, ByVal e As System.Data.SqlClient.SqlInfoMessageEventArgs) Handles SqlConnection1.InfoMessage End SubEnd Class(webform1.aspx)<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="WebApplication_01.WebForm1"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> <HEAD> <title>WebForm1</title> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <asp:DataGrid id=DataGrid1 style="Z-INDEX: 101; LEFT: 4px; POSITION: absolute; TOP: 4px" runat="server" DataSource="<%# DataSet11 %>" DataKeyField="Order#" DataMember="ORDERS"> <Columns> <asp:BoundColumn DataField="Record#" HeaderText="Record#"></asp:BoundColumn> <asp:BoundColumn DataField="Order#" HeaderText="Order#"></asp:BoundColumn> <asp:BoundColumn DataField="DateOpened" HeaderText="Date Opened"></asp:BoundColumn> <asp:BoundColumn DataField="DriverName" HeaderText="Driver Name"></asp:BoundColumn> <asp:BoundColumn DataField="Reference" HeaderText="Reference"></asp:BoundColumn> <asp:BoundColumn DataField="CustomerName" HeaderText="Customer Name"></asp:BoundColumn> <asp:BoundColumn DataField="StreetAddress" HeaderText="Street Address"></asp:BoundColumn> <asp:BoundColumn DataField="City" HeaderText="City"></asp:BoundColumn> <asp:BoundColumn DataField="State" HeaderText="State"></asp:BoundColumn> <asp:BoundColumn DataField="Zip" HeaderText="Zip"></asp:BoundColumn> <asp:BoundColumn DataField="OrderNotes" HeaderText="Order Notes"></asp:BoundColumn> <asp:BoundColumn DataField="OrderDueBy" HeaderText="Due By"></asp:BoundColumn> <asp:BoundColumn DataField="ServiceName" HeaderText="Service Type"></asp:BoundColumn> <asp:BoundColumn DataField="LastModified" HeaderText="Last Modified"></asp:BoundColumn> </Columns> </asp:DataGrid> </form> </body></HTML>(web.config)<?xml version="1.0" encoding="utf-8"?><configuration> <system.web> <!-- DYNAMIC DEBUG COMPILATION Set compilation debug="true" to insert debugging symbols (.pdb information) into the compiled page. Because this creates a larger file that executes more slowly, you should set this value to true only when debugging and to false at all other times. For more information, refer to the documentation about debugging ASP.NET files. --> <compilation defaultLanguage="vb" debug="true" /> <!-- CUSTOM ERROR MESSAGES Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable. Add <error> tags for each of the errors you want to handle. "On" Always display custom (friendly) messages. "Off" Always display detailed ASP.NET error information. "RemoteOnly" Display custom (friendly) messages only to users not running on the local Web server. This setting is recommended for security purposes, so that you do not display application detail information to remote clients. --> <customErrors mode="RemoteOnly" /> <!-- AUTHENTICATION This section sets the authentication policies of the application. Possible modes are "Windows", "Forms", "Passport" and "None" "None" No authentication is performed. "Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to its settings for the application. Anonymous access must be disabled in IIS. "Forms" You provide a custom form (Web page) for users to enter their credentials, and then you authenticate them in your application. A user credential token is stored in a cookie. "Passport" Authentication is performed via a centralized authentication service provided by Microsoft that offers a single logon and core profile services for member sites. --> <authentication mode="Windows" /> <!-- AUTHORIZATION This section sets the authorization policies of the application. You can allow or deny access to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous (unauthenticated) users. --> <authorization> <allow users="*" /> <!-- Allow all users --> <!-- <allow users="[comma separated list of users]" roles="[comma separated list of roles]"/> <deny users="[comma separated list of users]" roles="[comma separated list of roles]"/> --> </authorization> <!-- APPLICATION-LEVEL TRACE LOGGING Application-level tracing enables trace log output for every page within an application. Set trace enabled="true" to enable application trace logging. If pageOutput="true", the trace information will be displayed at the bottom of each page. Otherwise, you can view the application trace log by browsing the "trace.axd" page from your web application root. --> <trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" /> <!-- SESSION STATE SETTINGS By default ASP.NET uses cookies to identify which requests belong to a particular session. If cookies are not available, a session can be tracked by adding a session identifier to the URL. To disable cookies, set sessionState cookieless="true". --> <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20" /> <!-- GLOBALIZATION This section sets the globalization settings of the application. --> <globalization requestEncoding="utf-8" responseEncoding="utf-8" /> </system.web> <appSettings> <!-- User application and configured property settings go here.--> <!-- Example: <add key="settingName" value="settingValue"/> --> <add key="SqlConnection1.ConnectionString" value="workstation id=MyID;packet size=4096;integrated security=SSPI;data source=MyServerName;persist security info=False;initial catalog=MySQLDataBaseName" /> </appSettings></configuration>
Hi,In vs.net 2003 I created a webapplication and by toolbox/data/SqlDataAdapter I created a connection andthe adapter. I added a dataset and all went OK.In created another webapplication, did the same procedure and I got the error above mentioned. How come ?Help is appreciated, Ger.
Any help would be very very much appreciated as I am about 15 hours into this :(
Background is a development system with ASP.NET 2.0 and SQL express 2005. The server is SQL 2005 standard edition. Any ASPX pages that connect to a database results in errors.
I have 2 identical servers with Windows server 2003, one has SQL Express and the other has SQL Server 2005 standard. that is the only difference between these systems. The scripts that work seamlessly when uploaded to the SQL Express server dont work on the SQL Server 2005
1.) No matter what the initial catalog is pointing to, I get the same error. EVEN if the database doesnt exist
Cannot open database "C:INETPUBWWWROOT estapp_dataaspnwet.MDF" requested by the login. The login failed. Login failed for user 'NT AUTHORITYNETWORK SERVICE'.
2.) second interesting thing is this, if I change the datasource to "MSSQLSERVER" which is the instance name of SQL 2005. the error changes to
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
I have reinstalled SQL server 2005
I have verified that under SQL Server 2005 Surface Area Configuration that remote connections has Both TCP and Named Pipes enabled
I have verified that under the Network Configuration that the protocols for TCP/IP and Named pipes are enabled.
I have tried atleast 20 different variations of Connectionstrings
I have ran aspnet_regsql against the database
I have verified that the SQL Server Browser is started
I have verified that the TCP/IP is set in Network Configuration to default port 1433
I have gave all authentication rights to Network Service and ASPNET accounts for testing against both the MASTER and ASPNET databases using Management Studio and attaching the Database
I have created a custom SQL account with access to the database in question and added the username password syntax to the connectionstring and get the same login failed message.
If anyone can give any insight that would be MUCH appreciated!! thanks in advance.
Every so often I get an error when I pull up an ASP.NET 2.0 site using SQL Express. It tells me that the login failed. If I go into the server's administrative tools > services and restart SQL Express and then refresh the site, it works just fine. Is this some sort of bug or memory issue? Does the application need to connect every so often or end up falling out somewhere?
(1) SQL 2005 on a member server, Windows Authentication
(2) I'm using Visual Studio.Net 2005 on my Windows XP sp2 work station.
(3) From my machine, within my development application, I have no problem accessing the Data in the SQL server.
(4) I Receive the Login Failed error after I copy my project to the Test Web Server (Same machine that houses SQL) and test from either my machine or from the host server.
More details of the error message are:
Login failed for user 'NT AUTHORITYNETWORK 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.SqlClient.SqlException: Login failed for user 'NT AUTHORITYNETWORK SERVICE'.
Source Error:
Line 33: DA = New SqlDataAdapter(sSql, CONN_STRING) Line 34: DS = New DataSet Line 35: DA.Fill(DS) Line 36: Line 37: Session("NameInquiry_DS") = DS
The finished product is to be an Intranet site only; accessible by employees within our own private network.
The SQL is a new install with only test data.
What have I missed that is causing the permission problem? The event viewer shows a nonauthenticated user is causing the problem. But, how do I correct this?
Anyone live in seattle (meet on cap hill)? I have been stuck for weeks now and can't wait any longer wasting time - i will pay someone to set me up correctly quickly. I doubt this will be resolved online, but here goes... I need a datagrid to bring up simple database info (northwind) instead of showing the error 'login failed for mycomputeraspnet'. I am using windows authentication and my string is connectionstring = datasource=(local)\netsdk;initial catalog=Northwind;integrated security=sspi; persistent security=false;, I have seen online they say alter the authorization in the app virtual directory-- is that the C/inetpub/wwwroot or the web config of my project? I did so in the web config of my project, and also I added the impersonate=true to same already. I shared all the folders and made sure they are not read-only. I am flabbergasted. Paul XP pro 2004 sp 2 vis studio 2002 w updates C# Asp web app project
Hi-- I am building an intRAnet website using windows authentication for website access and SQL Server access ( Trusted_Connection = true ). In IIS I have these settings:
Allow Anonymous = unchecked (false) Windows Authentication = Checked (true) Digest windows = checked (true) In my Web.Config file:
authentication="windows" impersonate="true" allowusers="*" When I pull up the page these are my credentials: Security.Principal.Windows: mydomainmyuserid (this is correct what it shows on my page) Me.User.Identity: mydomainmyuserid (this is correct what it shows on my page) Threading.currentThread.currentUser mydomainmyuserid (this is correct what it shows on my page)
So the ASP.NET page recognizes it is me and my domain. However, when i click a button to pull some data from a database I get the error message: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. My data access on SQL Server works fine. The weird thing is when I debug on my machine it pulls data fine. but when I copy the files to the windows 2003 server it doesn't work. Do i have to do something with delegation?
hi, so i have a new box and I'm trying to get my websites and SQL Server 2005 Standard Edition working on it, but the pages give me the following error when I try to load them: "Cannot Open Database "XXXX" requested by login. The login failed. Login failed for user 'xxx'" Everything seems exactly the same settings and user-wise from my old box to my new one, but nevertheless everything I've tried gives me the same error. I've tried creating new users in SQL Server and giving them appropriate permissions to my database. I've even tried just using the built in 'sa' account. Nothing seems to change the error, except when I give it the incorrect password then it just says 'login failed' This leads me to believe that i'm successfully logging into the SQL Server, but it doesn't want to give me access to the database I'm requesting access too. But "apparently" the account i'm using should have access to the database. If nothing else the 'sa' account should, but that didn't work either. I'm stumped. Any ideas?
I've got a weird issue on my hands. I've got a 2 node/instance SQL 2005 SP2 Enterprise cluster on Server 2003 Enterprise, that's getting an odd event log error over and over. The service account that runs everything (SQL Services, Agent, Analysis Svcs, etc...) is a domain admin. The account is not locked out. SQL Server seems to be running fine. But, if you look in the SQL Server logs or the application logs, all you see are thousands of errors just like this:
Type: Failure Audit Source: MSSQLSERVER Event ID: 18456 Login failed for user 'domainServiceAccount'. [CLIENT: xxx.xxx.xxx.xxx]
(BTW - the ip addr in the error is of that virtual instance of SQL Server.)
On the Server Evt log, it only shows up in the App log. In the security log, all of the audits related to this service acct are successes.
It happens on both instances of the 2005 cluster. But my SQL 2000 cluster (which uses the same service account) is having no problems at all. I've tried everything I could think of to diagnose/fix the issue and just can't seem to figure it out.
- verify that BUILTINAdministrators is an SA in SQL - verify that NT AUTHORITYSYSTEM is an SA in SQL - verify that the service account is an admin on both physical boxes. - verify that there are no 'deny' permissions set on any of the system databases for the service account (or the two above built in groups).
Any ideas? I can't find anything on the web about it that's helped so far. Basically everything seems to be negated by the fact that the account is NOT locked out and the fact that the account is a domain admin. Luckily it's not causing any problems for me (at the moment), but I'm trying to diagnose a different issue and I can't seem to shake the possibility that both of the issues are related.
Hi, Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITYLOCAL SERVICE'. my applicaton working on other machine perfect with the same code but when i upload on web server showing me above error.
I need help with a problem: When trying to process a analysis services project, I receive the following error message -
OLE DB error: OLE DB or ODBC error: Login failed for user 'NT AUTHORITYLOCAL SERVICE'.; 28000; Cannot open database "DocumentDB" requested by the login. The login failed.; 42000.
I am using the service account for impersonation for the datasource. One suggestion I received from the data-access forum was to grant privileges to the local service for the database. I am not clear about the procedure to do that. Can someone please guide me through this? I am posting this question in this forum since this is a authentication/privilege issue.
I'm installing Windows Small Business Server 2003 R2 Premium. I am at the stage where I am installing the Premium Technologies. Specifically, I am trying to configure permissions for the new SHAREPOINT instance of SQL Server 2005. When I try to create the new login NT AuthorityNetwork Service, typing it exactly as specified in the instructions, I get the following error:
Create failed for Login 'NT AUTHORITYNetwork Service' (Microsoft.Sqlserver.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Login&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Windows NT user or group 'NT AUTHORITYNetwork Service' not found. Check the name again. (Microsoft SQL Server, Error: 15401)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=15401&LinkId=20476
I got a website using .Net v2.0.xxx and SQL Server Express 2005 in a Win2003 Domain Controller machine. Both website and SQLServer is running on the same machine. Website and SQLServer are configured to accept only Integrated Windows Authentication. Domain Users group is added in SQLServer logins list and given Read and Write access to the database used by the website. Also Domain Admins groups is added and given full permission to the same database.
I thought since website will run only with login details from Active Directory, SQL Server connection is also going to be validated against the same login details. But I felt I got the whole concept wrong when I received the error mentioned in subject line.
Can anyone please explain the best way to connect to database in above-mentioned context. Please remember that I need to implement different rights on the database for 'Domain Users' and 'Domain Admins' group. If there is a better approach than using these groups, lemme know please.