Asynchronous Web Services calls with Impersonation


D

Dave

Hello,

I have a problem with Impersonation with ASPX pages running with
Impersonation that call Web Services Asynchonously that the
Impersonated credentials are not passed to the Web Service when called
with the Begin... method, however they are when the Web Service is
called normally.

Microsoft .NET 2, Visual Studio 2005 Pro

-- SAMPLE ASPX Page --
Dim oService As New samplews.SampleService
oService.Credentials =
System.Net.CredentialCache.DefaultCredentials
oService.BeginWhoAmI(AddressOf callback, Nothing)


-- SNIPPET FROM THE SAMPLE WEB SERVICE --
<WebMethod()> _
Public Sub WhoAmI()
Dim oSR As New System.IO.StreamWriter("c:\temp
\wswhoami.txt", True)
oSR.WriteLine(My.User.Name)
oSR.Close()
End Sub


The subroutine - when run on Windows XP reports back as
COMPUTERNAME\ASPNET.


I can work around the problem by editing the ASPNET.CONFIG file,
however I don't like this idea as this will effect all applications
and the application I develop may well have to run alongside other Web
Applications.


<configuration>
<runtime>
<alwaysFlowImpersonationPolicy enabled="true"/>
<legacyImpersonationPolicy enabled="false"/>
</runtime>
</configuration>


Is there another way to pass my current credentials to the Web Service
when run Asyncronously? If I could send the Web Service my
System.Security.Principal.WindowsIdentity.GetCurrent() I could
run .Impersonate against it but I'm not sure how to send this Object
to the Web Service


Help!



Regards,



David Homer
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top