473,325 Members | 2,771 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,325 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 1703

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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.