473,499 Members | 1,591 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

why aspnet instead of logged in user when trusted_connection=yes

I am using the following code and it works when I have aspnet as a bona fide
user in the sql server database. Why doesn't the use of trusted connection
allow me as logged in user and dbo of database to access dbase. If I do not
have aspnet on the sql side I get login failed machinename/aspnet??

Dim myConnString As String =
"SERVER=fcstestbox;Trusted_Connection=yes;DATABASE =sex_offender_group;"
Dim myconnection As New System.Data.SqlClient.SqlConnection(myConnString)
Dim sqlstr As String = "insert into tblname
(fname,lname,clientID,dob,agetype) values('" & TextBox1.Text &
"','akin',1,'2/24/51','a')"
Dim objsqlcommand As New System.Data.SqlClient.SqlCommand(sqlstr,
myconnection)
myconnection.Open()
objsqlcommand.ExecuteNonQuery()
myconnection.Close()

Apr 4 '06 #1
1 1761
bindurajeesh wrote:
I am using the following code and it works when I have aspnet as a bona fide
user in the sql server database. Why doesn't the use of trusted connection
allow me as logged in user and dbo of database to access dbase. If I do not
have aspnet on the sql side I get login failed machinename/aspnet??

Dim myConnString As String =
"SERVER=fcstestbox;Trusted_Connection=yes;DATABASE =sex_offender_group;"
Dim myconnection As New System.Data.SqlClient.SqlConnection(myConnString)
Dim sqlstr As String = "insert into tblname
(fname,lname,clientID,dob,agetype) values('" & TextBox1.Text &
"','akin',1,'2/24/51','a')"
Dim objsqlcommand As New System.Data.SqlClient.SqlCommand(sqlstr,
myconnection)
myconnection.Open()
objsqlcommand.ExecuteNonQuery()
myconnection.Close()


It's called the one-hop rule; NTLM/credentials can only hop from one
computer to another once within a network. i.e. from the user's
browser/PC to your webserver = 1 hop. So even tho you impersonate on
the server, this rule stops it from being able to open the DB connection
as that user (= 2 hops). Falls back to machine account.

You have to either use Kerberos w/ forwarding on in your network
(usually not an option :) ), or grant access to the machine account (as
you've seen), or use a SQL account in your connection string.

--
Craig
Microsoft MVP - ASP/ASP.NET
Apr 4 '06 #2

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

Similar topics

4
1224
by: genc ymeri | last post by:
Hi I have placed an encounter code in the session_end as well in the session_start. I'm decreasing the number with 1 everytime a session ends. I open several IE-s and I closed some of them but...
2
7144
by: hazz | last post by:
I don't get it. I have a VS2005 solution with a web service project and a windows project. The web service when tested on its own works fine. But when I add it as a web reference and refer to it my...
3
3080
by: Maellic | last post by:
Hi, The website I am working on is built with ASP.NET and connects to a SQL Server 2000 database. The web server and database are on the same machine. I have recently tried to modify the timeout...
4
342
by: Kim Chi via DotNetMonster.com | last post by:
I encountered the above-mentioned error when building my webpage. According to the Microsoft KB on this problem, I have to add a" trusted_connection=yes" to the connection string and enter a...
4
4135
by: EvelynAnd Ethan | last post by:
Hi, ItemCommand event not firing from a dynamic user control ,WHERE A DATAGRID HAS BUTTON,when i click on the linkbutton first time the itemcommand event doesnt fire,second time event fires up ...
1
2032
by: jerminator | last post by:
Ok I need some help. Up until Tuesday my application was working fine. It is an asp.net application written in VB. It is very data heavy and makes multiple calls to a database. The application...
2
5199
by: tony wong | last post by:
My asp application works well when i set up a default user for the asp application. i wish to integrate user with SQL server by using "Trusted_Connection=Yes" it works well within the domain...
3
3079
by: =?Utf-8?B?QXho?= | last post by:
Is there a limitation on the number of (sequential) opened connection for SQL Server User Instances? The following method will run to about the 240th iteration then will receive a timeout...
1
1513
by: tleper | last post by:
hi, there are two win2003 servers in the same workgroup. one has mssql 2000 server and other one has asp.net 2.0 web application connecting that mssql server. mssql server Authentication is SQL...
0
7130
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,...
0
7007
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...
0
7220
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...
0
7386
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5468
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,...
1
4918
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...
0
3098
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...
0
1427
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 ...
0
295
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.