Asynchronous Web Services calls with Impersonation

Discussion in 'ASP .Net Security' started by Dave, Jul 28, 2007.

  1. Dave

    Dave Guest

    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 (I got the idea to try this from
    http://www.leastprivilege.com/WhatIsAspnetconfig.aspx)


    <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
     
    Dave, Jul 28, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. zg_yuan
    Replies:
    0
    Views:
    382
    zg_yuan
    Aug 25, 2003
  2. Jonathan Trevor
    Replies:
    6
    Views:
    3,583
    sahar
    Nov 5, 2010
  3. =?Utf-8?B?VHJvdHNreQ==?=

    ASP.Net with Asynchronous Web Service calls

    =?Utf-8?B?VHJvdHNreQ==?=, Apr 30, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    4,573
    =?Utf-8?B?VHJvdHNreQ==?=
    May 3, 2004
  4. Jason Elliott

    Impersonation not working with Asynchronous calls

    Jason Elliott, Dec 11, 2003, in forum: ASP .Net Security
    Replies:
    0
    Views:
    178
    Jason Elliott
    Dec 11, 2003
  5. Dave

    Asynchronous Web Services calls with Impersonation

    Dave, Jul 28, 2007, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    136
Loading...

Share This Page