473,322 Members | 1,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Starting async web method calls within callback from another metho

Hi,

impersonation effectively means that you setting your current thread in the security context of your client.

When you invoke a web service asynchronously, .net grabs a thread from the thread pool and executes the request. you have to rely on the framework that your impersonated account gets copied to the new thread. this behaviour is kind of "inconsistent" within .net 1.1

e.g. BeginInvoke on delegates and Thread.Start copy Thread.CurrentPrincipal to the worker thread. ThreadPool.QueueUserWorkerItem and Timer.Start don't.

Check what's in Thread.CurrentPrincipal (e.g. with debug.writeline) in your callback method. maybe you have to programmatically impersonate with,

WindowsIdentity id = (WindowsIdentity)Thread.CurrentPrincipal.User;

WindowsImpersonationContext context = id.Impersonate();

...

context.Undo();

---
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

nntp://news.microsoft.com/microsoft.public.dotnet.framework.webservices/<5D**********************************@microsoft.co m>

Hi,

I have a couple of web services on two servers. I want to call one method on
one server, and based upon its result, call another method on another server.
Currently I am doing all these calls asynchronously and I call the
beginmethod call for the second call in the callback of the first. I am using
the default credentials for both web service proxy objects (which have been
set up earlier), but the second web method (which happens to be on the local
machine) is being run not as the user, but as NT AUTHORITY\SYSTEM. I have
impersonation set to true in my web.config.

Can anyone shed any light on why I get this problem? Is it bad to do this
within a callback? Any advice would be very welcome!

Thanks in advance
John Roper
iOra

[microsoft.public.dotnet.framework.webservices]
Nov 21 '05 #1
0 1702

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

Similar topics

1
by: scott ocamb | last post by:
hello I have implemented a solution using async methods. There is one async method that can be invoked multiple times, ie there are multiple async "threads" running at a time. When these...
39
by: jabailo | last post by:
I am looping through a text file, and with each row, I launch a web service, asynchronously. Before I move on to the next step in the process, I want to make sure that all the web services have...
6
by: Amy L. | last post by:
I am working on a project where I will have a ton of async DNS calls in a console application. I would like to process the results of the Aync calls on the same thread that made the async call. ...
10
by: Shawn Meyer | last post by:
Hello - I am trying to write a class that has an async BeginX and EndX, plus the regular X syncronous method. Delegates seemed like the way to go, however, I still am having problems getting...
0
by: John Roper | last post by:
Hi, I have a couple of web services on two servers. I want to call one method on one server, and based upon its result, call another method on another server. Currently I am doing all these...
11
by: ryan | last post by:
Hi, I've omitted a large chunk of the code for clarity but the loop below is how I'm calling a delegate function asynchronously. After I start the each call I'm incrementing a counter and then...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
6
by: Shak | last post by:
Hi all, Three questions really: 1) The async call to the networkstream's endread() (or even endxxx() in general) blocks. Async calls are made on the threadpool - aren't we advised not to...
7
by: Shak | last post by:
Hi all, I'm trying to write a thread-safe async method to send a message of the form (type)(contents). My model is as follows: private void SendMessage(int type, string message) { //lets...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.