Showing posts with label visual. Show all posts
Showing posts with label visual. Show all posts

Friday, March 30, 2012

Login failed for user 'NT AUTHORITY\NETWORK SERVICE'

I have:

(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 AUTHORITY\NETWORK 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 AUTHORITY\NETWORK 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

Source File: C:\Inetpub\wwwroot\nameinquiry\NameInquiry.aspx.vb Line: 35

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?

Could you please post the connection string here and the part of the web.config file about impersonation (if any and not commented out). This is a configuration problem. Which user do you want to authenticate while connecting to the database ?

http://msdn2.microsoft.com/en-us/library/aa302377.aspx

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de|||

Hi, Terry

Try to read following article, they probably include solution to your problem:

1) http://support.microsoft.com/kb/316989/

2) https://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=348662&SiteID=17

3) http://msdn2.microsoft.com/en-us/library/ab4e6cky(vs.80).aspx

Good Luck!

Ming.

|||

Here is my connection string and the Web.Config.

What is confusing is that I have zero issues running the application within VS ASP.NET. It's only when I run the application outside the development software.

When I check the Event Viewer on the server that houses SQL, the login name is blank. That's why I believe I have a permissions error. I just don't have any idea what permissions to set. It doesn't matter which desktop I use, the connection fails. If I try to access the website from the Server it's housed using the administrator login, I still get the Login failed message.

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<appSettings>
<add key="ConnStringer" Value="packet size=4096;Data Source=MYSERVER;Initial Catalog=MyDataBase;Integrated Security=True;"/>
</appSettings>

<connectionStrings>
<add name="myConnection" connectionString="server=MYSERVER;database=MyDataBase;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<authentication mode="Forms" />
<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.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>

-->

<anonymousIdentification enabled="true"/>
<profile enabled="true">
<properties>
<add name="myGroupID" allowAnonymous="true"/>
<add name="myUserID" allowAnonymous="true"/>
</properties>
</profile>


</system.web>
</configuration>

|||

Ming,

The articles were very informitive but none of the possible solutions resolved my problem.

In an earlier post, I stated that everything worked fine within my VS .NET application. I have since learned that as long as I view data only, it works. If I attempt to do any writes, the application fails. Therefore, I'm more convinced this is an authentication related issue. Now I'm asking the following questions as I try to locate and resolve this issue:

I have determined that NT AUTHORITY\NETWORK SERVICE is the default login when I run my application. Based on what I've read from the many web posts concerning Windows Authenticaion, this is normal. How do I control the default login name? Meaning, can this be changed? If so, How? Should it be changed? Can I set various permissions to the various SQL databases? If so, How?

|||

Are your client and server machine in WORKGROUP instead of domain? If so, can you try grant database login to "<machinename>\guest" see whether it works?

As for your questions that how to control default login name, it is more of ASP.NET configuration issue, such as you can change ASP.NET account( http://www.bluevisionsoftware.com/WebSite/TipsAndTricksDetails.aspx?Name=AspNetAccount)

or post your question in ASP.NET forum.

The workaround here is

1) Change your connection string to force tcp connection(adding prefix "tcp:" in DataSource field ).

2) Use SQL authentication.

Good Luck!

Ming.

|||


Hi,

using Anonymous authentication will make you able to use a single user connecting to the database. This uer has to be setup in the security tab of the website in the IIS configuration screen. If you want to use this combination, you will have to set the tag of the web.config to impersonate=true. This will let you use login procided within the IIS to access SQL Server. If you want to authenticate / impersonate the user which is currently accessing the web page, you will have to (assuming that the web server is on the same server as the SQl Server) disbal the anonymous access option in the IIS configuration dialog.

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||

I think that the 3rd of Ming's posts alludes to the potential problem and provides links to additional relevant info (and your hunch about authentication related issue would also be accurate). The most likely source of the problem, as Ming and Jens have pointed out, is impersonation.

NT AUTHORITY\NETWORK SERVICE is the account that IIS runs under on Windows Server 2003 and without any additional configuration, this is the account that will attempt to access whatever resources the web application needs. Since this is the account that is trying to access the database, it appears that the outbound attempt is not attempting the connection as the connected user. This is where the web.config settings that Jens mentioned come into play and there's a good synopsis of the options available on http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetAP05.asp (this looks identical to the link Jens posted earlier). You probably don't need or want IIS to run under a different account.

If you want each domain user to have a separate connection to the database, you will need to disable Anonymous Access and turn on Integrated Windows authentication (this would be on the Directory Security tab for the web site in IIS Manager). You'd then specify <identity impersonate="true"/> in your web.config. You may also want to change the <authentication> element to be mode="Windows"...check with MSDN and or the ASP.NET forum for additional info/guidance on the specifics there, as I'm well outside my area of expertise on that point.

If you want all DB access to route through a single connection (I'm not entirely sure that's advisable, but your circumstances may dictate this) and/or as a single user (also not advisable...auditability of data written to the database would be compromised, so you wouldn't be able to determine who made a given change), you could continue to use Integrated Windows authentication on your web app but change the web.config to be:

<identity impersonate="false"/>

<authentication mode="Windows"/>

You'd then provide access to the SQL Server table via one of the server roles for the NT AUTHORITY\NETWORK SERVICE account. An example would be to use sp_addrolemember to add this account to public and grant public insert and update permissions on these tables (if it doesn't have them already).

There is a "How To" article on these options available at: http://msdn2.microsoft.com/en-us/library/ht43wsex(VS.80).aspx

Good luck,

Jason

Login failed for user 'NT AUTHORITY\NETWORK SERVICE'

I have:

(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 AUTHORITY\NETWORK 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 AUTHORITY\NETWORK 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

Source File: C:\Inetpub\wwwroot\nameinquiry\NameInquiry.aspx.vb Line: 35

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?

Could you please post the connection string here and the part of the web.config file about impersonation (if any and not commented out). This is a configuration problem. Which user do you want to authenticate while connecting to the database ?

http://msdn2.microsoft.com/en-us/library/aa302377.aspx

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de|||

Hi, Terry

Try to read following article, they probably include solution to your problem:

1) http://support.microsoft.com/kb/316989/

2) https://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=348662&SiteID=17

3) http://msdn2.microsoft.com/en-us/library/ab4e6cky(vs.80).aspx

Good Luck!

Ming.

|||

Here is my connection string and the Web.Config.

What is confusing is that I have zero issues running the application within VS ASP.NET. It's only when I run the application outside the development software.

When I check the Event Viewer on the server that houses SQL, the login name is blank. That's why I believe I have a permissions error. I just don't have any idea what permissions to set. It doesn't matter which desktop I use, the connection fails. If I try to access the website from the Server it's housed using the administrator login, I still get the Login failed message.

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<appSettings>
<add key="ConnStringer" Value="packet size=4096;Data Source=MYSERVER;Initial Catalog=MyDataBase;Integrated Security=True;"/>
</appSettings>

<connectionStrings>
<add name="myConnection" connectionString="server=MYSERVER;database=MyDataBase;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<authentication mode="Forms" />
<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.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>

-->

<anonymousIdentification enabled="true"/>
<profile enabled="true">
<properties>
<add name="myGroupID" allowAnonymous="true"/>
<add name="myUserID" allowAnonymous="true"/>
</properties>
</profile>


</system.web>
</configuration>

|||

Ming,

The articles were very informitive but none of the possible solutions resolved my problem.

In an earlier post, I stated that everything worked fine within my VS .NET application. I have since learned that as long as I view data only, it works. If I attempt to do any writes, the application fails. Therefore, I'm more convinced this is an authentication related issue. Now I'm asking the following questions as I try to locate and resolve this issue:

I have determined that NT AUTHORITY\NETWORK SERVICE is the default login when I run my application. Based on what I've read from the many web posts concerning Windows Authenticaion, this is normal. How do I control the default login name? Meaning, can this be changed? If so, How? Should it be changed? Can I set various permissions to the various SQL databases? If so, How?

|||

Are your client and server machine in WORKGROUP instead of domain? If so, can you try grant database login to "<machinename>\guest" see whether it works?

As for your questions that how to control default login name, it is more of ASP.NET configuration issue, such as you can change ASP.NET account( http://www.bluevisionsoftware.com/WebSite/TipsAndTricksDetails.aspx?Name=AspNetAccount)

or post your question in ASP.NET forum.

The workaround here is

1) Change your connection string to force tcp connection(adding prefix "tcp:" in DataSource field ).

2) Use SQL authentication.

Good Luck!

Ming.

|||


Hi,

using Anonymous authentication will make you able to use a single user connecting to the database. This uer has to be setup in the security tab of the website in the IIS configuration screen. If you want to use this combination, you will have to set the tag of the web.config to impersonate=true. This will let you use login procided within the IIS to access SQL Server. If you want to authenticate / impersonate the user which is currently accessing the web page, you will have to (assuming that the web server is on the same server as the SQl Server) disbal the anonymous access option in the IIS configuration dialog.

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||

I think that the 3rd of Ming's posts alludes to the potential problem and provides links to additional relevant info (and your hunch about authentication related issue would also be accurate). The most likely source of the problem, as Ming and Jens have pointed out, is impersonation.

NT AUTHORITY\NETWORK SERVICE is the account that IIS runs under on Windows Server 2003 and without any additional configuration, this is the account that will attempt to access whatever resources the web application needs. Since this is the account that is trying to access the database, it appears that the outbound attempt is not attempting the connection as the connected user. This is where the web.config settings that Jens mentioned come into play and there's a good synopsis of the options available on http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetAP05.asp (this looks identical to the link Jens posted earlier). You probably don't need or want IIS to run under a different account.

If you want each domain user to have a separate connection to the database, you will need to disable Anonymous Access and turn on Integrated Windows authentication (this would be on the Directory Security tab for the web site in IIS Manager). You'd then specify <identity impersonate="true"/> in your web.config. You may also want to change the <authentication> element to be mode="Windows"...check with MSDN and or the ASP.NET forum for additional info/guidance on the specifics there, as I'm well outside my area of expertise on that point.

If you want all DB access to route through a single connection (I'm not entirely sure that's advisable, but your circumstances may dictate this) and/or as a single user (also not advisable...auditability of data written to the database would be compromised, so you wouldn't be able to determine who made a given change), you could continue to use Integrated Windows authentication on your web app but change the web.config to be:

<identity impersonate="false"/>

<authentication mode="Windows"/>

You'd then provide access to the SQL Server table via one of the server roles for the NT AUTHORITY\NETWORK SERVICE account. An example would be to use sp_addrolemember to add this account to public and grant public insert and update permissions on these tables (if it doesn't have them already).

There is a "How To" article on these options available at: http://msdn2.microsoft.com/en-us/library/ht43wsex(VS.80).aspx

Good luck,

Jason

Login failed for user NT AUTHORITY\NETWORK SERVICE

I have built a web page in visual web developer express and I moved it over to use IIS. I gave NT AUTHORITY\NETWORK 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 AUTHORITY\NETWORK SERVICE. Can any one help.

Server Error in '/' Application.

Cannot open user default database. Login failed.
Login failed for user 'NT AUTHORITY\NETWORK 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 AUTHORITY\NETWORK 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 AUTHORITY\NETWORK 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

Hi matt,

You have using Integrated Security=SSPI in your connection string. You would have to use: User ID and Password.

Good Coding!

Javier Luna
http://guydotnetxmlwebservices.blogspot.com/

|||

This is a common login failure when the application runs under IIS, and the 'NT AUTHORITY\NETWORK SERVICE' is the account used by IIS6.0. You may take a look at this post:

http://forums.asp.net/thread/1325077.aspx

sql

Wednesday, March 28, 2012

Login failed for user MCTSERVER01\ASPNET.

Hi,

Hope someone can help me to solve the error message.

I am using Visual Studio 2005 and MS SQL Server 2005. When I tried to run the aspx, I encountered the error listed below.

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

Login failed for user 'MCTSERVER01\ASPNET'.
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 'MCTSERVER01\ASPNET'.

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): Login failed for user 'MCTSERVER01\ASPNET'.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734947
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, ...

Siew HinSmile

As the error message states, looks like the user does not have enough permissions. Check under the Database -> Security -> Logins and see what permissions the user has.sql

Login failed for user machinename/ASPNET

Hi all,

I am new to ASP .NET and now I have been messing two days with the connection thing. I use the Visual Studio 2003 provided drag and drop SqlDataAdapter and SqlConnection to connect to the SQL 2000 server, developer edition (configured with the Windows authentication mode), but whenever I tried I always got a "Login failed for user mymachine/ASPNET" error. Can anyone help me with this? I have also tried, as somebody did, adding one line "<identity imperonate="true"/> to the Web.config file, but had the same kind of error. Do I have do make some change to my SQL server?

Thanks a lot!

Charlize

Yes, to resolve the issue completely, you really need to add the ASPNET account to your SQL login and give proper permissions to it. There are lots of similar posts, for example you can take a look at this post:

http://forums.asp.net/thread/1301014.aspx

|||

Hi Jay,

Thanks very much for the direction and it was very helpful, now I got it made!

Login failed for user ''. The user is not associated with a trusted SQL Server connectio

My machine has Win XP and IIS 5.1.
I installed Visual Studio 2005 without SQL Express 2005. SQL Server
2005 is installed on another machine with Win 2003.
I created a Web Site in .NET VB. I created a connection with my SQL
server database, I can retrieve/ change data in SERVER EXPLORER. When I
try to create a gridview with data fron one table and to run the web
page in Internet Explorer I receive the following error.
Login failed for user ''. The user is not associated with a trusted SQL
Server connection.
Can you please help me ?
Which connection string are you using to connect to the database, I
guess you are using SQL Server authentication which isn=B4t setup
properly on your computer.
So switch to mixed authentication, or use a Windows account to connect
to the database-
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
|||Which connection string are you using to connect to the database, I
guess you are using SQL Server authentication which isn=B4t setup
properly on your computer.
So switch to mixed authentication, or use a Windows account to connect
to the database-
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
|||Hi
How do you set up your database? A Windows Authenication or Mixed?
<CLarkou@.gmail.com> wrote in message
news:1142862649.046140.21050@.z34g2000cwc.googlegro ups.com...
> My machine has Win XP and IIS 5.1.
> I installed Visual Studio 2005 without SQL Express 2005. SQL Server
> 2005 is installed on another machine with Win 2003.
> I created a Web Site in .NET VB. I created a connection with my SQL
> server database, I can retrieve/ change data in SERVER EXPLORER. When I
> try to create a gridview with data fron one table and to run the web
> page in Internet Explorer I receive the following error.
> Login failed for user ''. The user is not associated with a trusted SQL
> Server connection.
> Can you please help me ?
>
|||I am using the following:
<remove name="LocalSqlServer" />
<add name="SubDispConnectionString1" connectionString="Data
Source=CYNICSQL1;Initial Catalog=SubDisp;Integrated Security=True"
providerName="System.Data.SqlClient" />
|||Hi, I set it as "Integrated Security=True"
|||No, this is just the connection string, not themode SQL Server is set
to. The one (COnnectionString) is the client, the authentication mode
(mixed) is the server side.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
|||The reason people keep asking about authentication modes is that this error
message usually means you are trying to connect with a SQL Server login to a
SQL Server instance that only supports Windows authentication. It sounds
like this is not your issue because you are connecting with Integrated
Security and not supplying a user name or password. The other possible
cause is that the Windows user has no right to authenticate a Windows
connection on the server where SQL Server is running. This can be a "double
hop" error if you are using Windows authentication on the Web site. It
could also be a case that ASPUSER has no rights to connect to the SQL Server
machine.
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
<CLarkou@.gmail.com> wrote in message
news:1142867073.546213.317310@.t31g2000cwb.googlegr oups.com...
> Hi, I set it as "Integrated Security=True"
>
|||I tried creating a website with FILE SYSTEM, not HTTP, and I was able
to open the web page in IE with SQL server data. ASPUSER is used for
connecting to the SQL SERVER machine with FILE SYSTEM web site ?
|||The server authentication is "Windows Authentication Mode".

Monday, March 26, 2012

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server conn

Currently, i'm using Visual Web Developer 2005 to create my web site.

Once i connect to database, it's comes out this error for me "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."
I'm try to connect the database in microsoft server 2000.

How can I solve it?Can your mention what connection string you write in your code

Wednesday, March 21, 2012

Login failed for user

I published my web pages using Visual Studio 2005 to a local IIS server, the local machine has a proxie, when I published the pages on my personal laptop with a practice database on a SQL server it runs find, but when I put it on the machine with the actual running database on SQL Server 2005 I get the following error, can any please let me know what I can do to fix this problem.

Server Error in '/BPAlarmQuery' Application.

Login failed for user 'ODOWIN911\ASPNET'.

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 'ODOWIN911\ASPNET'.

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): Login failed for user 'ODOWIN911\ASPNET'.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734787 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.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83 System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770 System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +92 System.Web.UI.WebControls.ListControl.PerformSelect() +31 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82 System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +26 System.Web.UI.Control.PreRenderRecursiveInternal() +77 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360

Thank you in advance.

Try the suggestions on this page:

http://msdn2.microsoft.com/en-us/library/ab4e6cky.aspx

login failed for user

I have XP Pro installed with SQl Server 7.0. I use Visual
Studio.NET for programming ASP.NET(IIS is also
installed).When I run this, I get an error message

"login failed for user VENKY/ASPNET".

I did some search and many poeple seem to have these
errors but not one page says what is to be clearly done
for XP platform. One page said that I have to create a
domain user ASPNET and see to that this user has access
rights to SQL Server. COuld someone please tell the steps
to do this. Thanks a lot in advance.

Gayathri
.Is your sql server and iis running on the same machine ? What is your anonymous login set to under iis ?|||Originally posted by rnealejr
Is your sql server and iis running on the same machine ? What is your anonymous login set to under iis ?

Yes they are running on the same machine. Sorry what do you mean by anonymous login, where do you go and see that. Anyway yesterday we solved the problem somehow, did further research on the web and somehow solved it.

Thanks,

Gayathri|||To check the anonymous account used in iis - go into internet service manager. Right click on 'default web site'. Click on 'directory security' -> click edit under 'anonymous access ...) -> click edit under 'anonymous access'.

The solution may have been adding that username to sql server or the anonymous access login to sql server.

For future reference - the following is a helpful article from ms:

article (http://support.microsoft.com/default.aspx?scid=kb;EN-US;247931)sql

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.

login failed

Hi

I use visual basic 2005 express and wants to connect to a sql server 2005 express database . Im a newbie and has created a small database called test on my computer and now i just want to see if i can connect to it. My connection string is:

con.ConnectionString = "server=ACER\Sqlexpress;database=test;trusted_connection=true"

And when i run the app. and it get to the con.open() command the programs gives me this error

Cannot open database "test" requested by the login. The login failed.
Login failed for user 'ACER\Dan'

Acer is the name of my computer and my user name is Dan. Im the administrator of the computer and there is no password requered to log on.

Can anybody see where it is wrong?

You are admin on your PC, but your user id does not exist in a SQL Server and it does not know anything about it. This is why it fails. Integrated security for SQL Server does not mean that SQL Server automatically accepts all the users from the PC. It means that authintication is integrated with the Windows. To resolve this issue, you need to add your user id 'ACER\Dan' to the list of the users for your SQL Server database and then grant some permissions. Lext links show how to to do this

http://support.microsoft.com/kb/325003/en-us#XSLTH4213121122120121120120

http://support.microsoft.com/kb/240872/en-us

|||

Hi,

make sure that the database test exists on the instances SQLExpress. As the administrator you should be allowed to access the server and its databases, though you are in the role of the system administrators. (if this is the local system you are working on)


HTH, Jens Suessmeyer.

http://www.sqlserver2005.de