473,473 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Windows identity during asynchronous calls

I'm trying to access a SQL server from a thread started from an asp.net
application and get a "Cannot log into database as user null..." error. How
can I make the thread inherit the same identity as the calling process?
When I spin off the thread I have seen that it typically runs as NT
ANONYMOUS\SYSTEM (via
System.Security.Principal.WindowsIdentity.GetCurre nt().Name). I have had
intermittent success
passing the token of the calling process and impersonating it in the called
process but once in a while hit an exception when trying to impersonate.

Web Config of calling process:
<authentication mode="Forms" >
<forms name="adAuthCookie" loginUrl="_mem_bin/formslogin.aspx"
protection="All" path="/" timeout="60" ></forms>
</authentication>
<identity impersonate="true" />

Web Site Directory Security of calling process is set to Anonymous Access.
Account used for anonymous access is a user w/ permissions to our SQL Server
db. Windows Integrated Authentication is also checked.

calling asynchronous process:
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf lfd.SubmitRequest),
System.Security.Principal.WindowsIdentity.GetCurre nt().Token)

Impersonation Logic:
Sub SubmitRequest(ByVal Token As Object)
System.Security.Principal.WindowsIdentity.Imperson ate(CType(Token,
System.IntPtr))

Thanks,

Dave


Nov 17 '05 #1
0 884

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

Similar topics

2
by: Dion Heskett | last post by:
Hi I get a InvalidOperationException message when I click button2 at this line of code textBox1.Text = whoIs1.EndLookup( asyncResult ); Should I now be implementing the BackgroundWorker Class...
1
by: Dave Mullen | last post by:
I'm trying to access a SQL server from a thread started from an asp.net application and get a "Cannot log into database as user null..." error. How can I make the thread inherit the same identity...
1
by: dba123 | last post by:
I need to perform Asynchronous Inserts using DAAB. So far I have a method which does an insert but how can I do this Asyncronously so that it does not affect the load on our public production...
4
by: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post by:
I copied my portal to WIndows 2003 and now I am getting: Server Error in '/portal' Application. -------------------------------------------------------------------------------- The current...
1
by: jan.loucka | last post by:
I'm developing WinForms application in .NET 2.0 that talks to web service. The automatically generated proxy (reference class) has got methods for both synchronous and asynchronous invocations of...
1
by: jan.loucka | last post by:
I'm developing WinForms application in .NET 2.0 that talks to web service. The automatically generated proxy (reference class) has got methods for both synchronous and asynchronous invocations of...
1
by: jalupinu | last post by:
My OS is Winxp SP2 and the software I am having trouble with is Maximizer 9.5 Enterprise. It has a Web Portal feature that i am trying to use and followed the instructions to set it up however I keep...
2
by: =?Utf-8?B?d2R1ZGVr?= | last post by:
I have a website using windows integrated security, with anonymous access turned off. The site is used to query orders from a database and when the search takes a long time, a windows login box...
4
by: =?Utf-8?B?QXZhRGV2?= | last post by:
ASP.Net 2. We are migrating to Windows 2008 64 bit Server with IIS 7 from Windows 2003 32 Bit with IIS 6. A few library classes we wrote uses impersonation in code like explained in this...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
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
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
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.