473,698 Members | 2,972 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error "Login failed for user ..."

fl
I am running ASPNET on my local machine. I have a problem when I try to
connect to a SQL server database table. The data looks good when I right
click SqlDataAdapter1 to preview the data. When F5 to run it, I get this
error "Login failed for user '(null)'. Reason: Not associated with a
trusted SQL Server connection..."

Here is my code (they are all generated by the wizard):

Public Class WebForm1
Inherits System.Web.UI.P age

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Me.SqlDataAdapt er1 = New System.Data.Sql Client.SqlDataA dapter
Me.SqlInsertCom mand1 = New System.Data.Sql Client.SqlComma nd
Me.SqlConnectio n1 = New System.Data.Sql Client.SqlConne ction
Me.SqlSelectCom mand1 = New System.Data.Sql Client.SqlComma nd
Me.DataSet11 = New connectToDataba se.DataSet1
CType(Me.DataSe t11,
System.Componen tModel.ISupport Initialize).Beg inInit()
'
'SqlDataAdapter 1
'
Me.SqlDataAdapt er1.InsertComma nd = Me.SqlInsertCom mand1
Me.SqlDataAdapt er1.SelectComma nd = Me.SqlSelectCom mand1
Me.SqlDataAdapt er1.TableMappin gs.AddRange(New
System.Data.Com mon.DataTableMa pping() {New
System.Data.Com mon.DataTableMa pping("Table", "sav_custom er", New
System.Data.Com mon.DataColumnM apping() {New
System.Data.Com mon.DataColumnM apping("ctct_SE R_ID", "ctct_SER_I D"), New
System.Data.Com mon.DataColumnM apping("ctct_ID _RSSD", "ctct_ID_RSSD") ,
New System.Data.Com mon.DataColumnM apping("CTCT_LV L_CD",
"CTCT_LVL_CD")} )})
'
'SqlInsertComma nd1
'
Me.SqlInsertCom mand1.CommandTe xt = "INSERT INTO
dbo.sav_custome r(ctct_SER_ID, ctct_ID_RSSD, CTCT_LVL_CD) VALUES (@ctc" &
_
"t_SER_ID, @ctct_ID_RSSD, @CTCT_LVL_CD); SELECT ctct_SER_ID,
ctct_ID_RSSD, CTCT_L" & _
"VL_CD FROM dbo.sav_custome r"
Me.SqlInsertCom mand1.Connectio n = Me.SqlConnectio n1
Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@ctct_SER _ID",
System.Data.Sql DbType.VarChar, 8, "ctct_SER_I D"))
Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@ctct_ID_ RSSD",
System.Data.Sql DbType.Int, 4, "ctct_ID_RSSD") )
Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@CTCT_LVL _CD",
System.Data.Sql DbType.VarChar, 2, "CTCT_LVL_C D"))
'
'SqlConnection1
'
Me.SqlConnectio n1.ConnectionSt ring = "workstatio n
id=K1FZL00D0;pa cket size=4096;integ rated security=SSPI;d ata source=nt" &
_
"assql18;persis t security info=False;init ial catalog=Sadstat "

'
Me.SqlSelectCom mand1.CommandTe xt = "SELECT ctct_SER_ID,
ctct_ID_RSSD, CTCT_LVL_CD FROM dbo.sav_custome r WHERE (CTCT_L" & _
"VL_CD = '1') AND (ctct_SER_ID = 'FR2900')"
Me.SqlSelectCom mand1.Connectio n = Me.SqlConnectio n1
'
'DataSet11
'
Me.DataSet11.Da taSetName = "DataSet1"
Me.DataSet11.En forceConstraint s = False
Me.DataSet11.Lo cale = New
System.Globaliz ation.CultureIn fo("en-US")
CType(Me.DataSe t11,
System.Componen tModel.ISupport Initialize).End Init()

End Sub
Protected WithEvents Label1 As System.Web.UI.W ebControls.Labe l
Protected WithEvents SqlDataAdapter1 As
System.Data.Sql Client.SqlDataA dapter
Protected WithEvents SqlSelectComman d1 As
System.Data.Sql Client.SqlComma nd
Protected WithEvents SqlInsertComman d1 As
System.Data.Sql Client.SqlComma nd
Protected WithEvents SqlConnection1 As
System.Data.Sql Client.SqlConne ction
Protected WithEvents DataSet11 As connectToDataba se.DataSet1
Protected WithEvents DataGrid1 As System.Web.UI.W ebControls.Data Grid

'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
SqlDataAdapter1 .Fill(Me.DataSe t11)
DataGrid1.DataS ource = DataSet11
DataGrid1.DataB ind()
End Sub
End Class

I have check the security setting under C:\Inetpub\wwwr oot\. I have
tried to tweak around the connection strings. I don't know what else to
check. I would appreciate any input. Thanks.
Nov 18 '05 #1
1 2110
When trying to connect from an editor such as Visual Studio, you are using
your own user account. When trying to connect from a web page, the ASPNET
user account will be the one accessing the db. By default no anonymous
account is mapped onto a SQL Server user account. You can map the ASPNET
user account to a SQL Server user account inside SQL Server, but this isn't
a good idea if you aren't going to contorlthe server this is hosted on (and
also makes a possible security hazard). Your best bet is to use an actual
SQL Server login and pass that in the connection string as it's the easiest
thing to deploy in most scenarios.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP- FrontPage

"fl" <fz***@yahoo.co m> wrote in message news:41******** *******@yahoo.c om...
I am running ASPNET on my local machine. I have a problem when I try to
connect to a SQL server database table. The data looks good when I right
click SqlDataAdapter1 to preview the data. When F5 to run it, I get this
error "Login failed for user '(null)'. Reason: Not associated with a
trusted SQL Server connection..."

Here is my code (they are all generated by the wizard):

Public Class WebForm1
Inherits System.Web.UI.P age

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Me.SqlDataAdapt er1 = New System.Data.Sql Client.SqlDataA dapter
Me.SqlInsertCom mand1 = New System.Data.Sql Client.SqlComma nd
Me.SqlConnectio n1 = New System.Data.Sql Client.SqlConne ction
Me.SqlSelectCom mand1 = New System.Data.Sql Client.SqlComma nd
Me.DataSet11 = New connectToDataba se.DataSet1
CType(Me.DataSe t11,
System.Componen tModel.ISupport Initialize).Beg inInit()
'
'SqlDataAdapter 1
'
Me.SqlDataAdapt er1.InsertComma nd = Me.SqlInsertCom mand1
Me.SqlDataAdapt er1.SelectComma nd = Me.SqlSelectCom mand1
Me.SqlDataAdapt er1.TableMappin gs.AddRange(New
System.Data.Com mon.DataTableMa pping() {New
System.Data.Com mon.DataTableMa pping("Table", "sav_custom er", New
System.Data.Com mon.DataColumnM apping() {New
System.Data.Com mon.DataColumnM apping("ctct_SE R_ID", "ctct_SER_I D"), New
System.Data.Com mon.DataColumnM apping("ctct_ID _RSSD", "ctct_ID_RSSD") ,
New System.Data.Com mon.DataColumnM apping("CTCT_LV L_CD",
"CTCT_LVL_CD")} )})
'
'SqlInsertComma nd1
'
Me.SqlInsertCom mand1.CommandTe xt = "INSERT INTO
dbo.sav_custome r(ctct_SER_ID, ctct_ID_RSSD, CTCT_LVL_CD) VALUES (@ctc" &
_
"t_SER_ID, @ctct_ID_RSSD, @CTCT_LVL_CD); SELECT ctct_SER_ID,
ctct_ID_RSSD, CTCT_L" & _
"VL_CD FROM dbo.sav_custome r"
Me.SqlInsertCom mand1.Connectio n = Me.SqlConnectio n1
Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@ctct_SER _ID",
System.Data.Sql DbType.VarChar, 8, "ctct_SER_I D"))
Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@ctct_ID_ RSSD",
System.Data.Sql DbType.Int, 4, "ctct_ID_RSSD") )
Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@CTCT_LVL _CD",
System.Data.Sql DbType.VarChar, 2, "CTCT_LVL_C D"))
'
'SqlConnection1
'
Me.SqlConnectio n1.ConnectionSt ring = "workstatio n
id=K1FZL00D0;pa cket size=4096;integ rated security=SSPI;d ata source=nt" &
_
"assql18;persis t security info=False;init ial catalog=Sadstat "

'
Me.SqlSelectCom mand1.CommandTe xt = "SELECT ctct_SER_ID,
ctct_ID_RSSD, CTCT_LVL_CD FROM dbo.sav_custome r WHERE (CTCT_L" & _
"VL_CD = '1') AND (ctct_SER_ID = 'FR2900')"
Me.SqlSelectCom mand1.Connectio n = Me.SqlConnectio n1
'
'DataSet11
'
Me.DataSet11.Da taSetName = "DataSet1"
Me.DataSet11.En forceConstraint s = False
Me.DataSet11.Lo cale = New
System.Globaliz ation.CultureIn fo("en-US")
CType(Me.DataSe t11,
System.Componen tModel.ISupport Initialize).End Init()

End Sub
Protected WithEvents Label1 As System.Web.UI.W ebControls.Labe l
Protected WithEvents SqlDataAdapter1 As
System.Data.Sql Client.SqlDataA dapter
Protected WithEvents SqlSelectComman d1 As
System.Data.Sql Client.SqlComma nd
Protected WithEvents SqlInsertComman d1 As
System.Data.Sql Client.SqlComma nd
Protected WithEvents SqlConnection1 As
System.Data.Sql Client.SqlConne ction
Protected WithEvents DataSet11 As connectToDataba se.DataSet1
Protected WithEvents DataGrid1 As System.Web.UI.W ebControls.Data Grid

'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
SqlDataAdapter1 .Fill(Me.DataSe t11)
DataGrid1.DataS ource = DataSet11
DataGrid1.DataB ind()
End Sub
End Class

I have check the security setting under C:\Inetpub\wwwr oot\. I have
tried to tweak around the connection strings. I don't know what else to
check. I would appreciate any input. Thanks.

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
408
by: camaro77 majau via DotNetMonster.com | last post by:
Sorry by my english but i'm from spain. I have a problem and after search by the web i have know that is due by framework. The message is : setup error "failed to load ressouces from resource file please check your setup" It only appears when i'm using a p2p program called elephant,who needs framework to run.some month ago I instaled for first time elephant and framework,but i don't remember whar version of framework i had
0
2316
by: Paul | last post by:
I have an existing application that has been installed and running for several months. I recently made a minor change to this application. When the application is installed on the user machine and then run, I get the following error: Setup Error Failed to load resources from resource file. Please check your setup. The application was installed on a Windows XP SP2 machine. I have un-installed the .NET Framework 1.1 and latest hot-fix...
11
9843
by: MLH | last post by:
I copied the following code snippet from A97 HELP. Am getting an error at compile time suggesting there's a problem with the first line (compile error, user-defined type not defined). It is likely that I've left something out. Doesn't seem to like Dim dbs as Database - that's what's hi-lited after acknowledging the error. Can you see anything wrong with that syntax? Dim dbs As Database, rst As Recordset Dim rstEmployees As Recordset,...
9
3204
by: Tim D | last post by:
Hi, I originally posted this as a reply to a rather old thread in dotnet.framework.general and didn't get any response. I thought it might be more relevant here; anyone got any ideas? My questions are below... "David Good" wrote: > We have a network running both Win2k and Win2k3 webservers and our web sites > reside on a UNC network share that happens to be a Network Appliance NAS.
0
1775
by: bruce | last post by:
ASP.NET app running for about a year with no problem and suddenly this week it's giving error message. The same as the one decribed by another user. Even stranger is that we only have this problem from some web clients (desktop browser, IE) , some other people do not have problems at all from theirs desktop. =============================== I am getting the following message when I try to access the asp.dotnet pages of our website.
5
2631
by: Vijaya P Krishna | last post by:
Hi, I have a .NET Windows Forms application, written in VB.NET and C#. I am opening a URL from the application using Process.Start(). The URL points to a java servlet running on apache-tomcat. For some users the application shows an error dialog with following information. Another very interesting observation is that it's sending a lot of requests to the servlet within no time. Please note that this is not happening for all users.
1
4396
by: Javier Gogol | last post by:
error Login failed. Details: crdb_adoplus Plis help me, not display report : ( crystal report - ASP.Net "c#" - SQLServer2000 - VS.Net 2005 ) in browser ... ????
12
6560
by: Michael | last post by:
Please Help me. I've got a .Net 2003 program that attaches to a SQL Server machine and I'm getting the above error when a user tries to log in. The SQL server is setup to use Windows Auth. and I have added the new user to the database and have given the user access to the database for the app. But everytime I try and login using this users ID, I always get the error: Login failed for user Christian.Gaut If I login using my userid and...
2
9590
by: tvnaidu | last post by:
valgrind error - "failed to start tool 'memcheck' for platform x86-linux" no such file or dir copied all lib and bin files which are generated after I compiled valgrind package, when I run my exe with valgrind, I am getting above error, any idea? lib/ -rw-r--r-- 1 0 0 27934 default.supp -rwxr-xr-x 1 0 0 4636305 cachegrind-x86-linux -rwxr-xr-x 1 0 0 4891451 callgrind-x86-linux...
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8611
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7741
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.