CurrentPrincipal and new Thread

Discussion in 'ASP .Net Security' started by marcell@ids.co.za, Aug 18, 2004.

  1. Guest

    I have an ASP webapp that needs to access files using a UNC pathname to a
    network-share

    I setup "impersonation" and that all works as expected when executed in the
    CurrentThread.

    I need to kick-off a Method which will need exactly the same permissions
    inside a new,long running, low priority Thread.

    Problem is even if I set the new Thread's.CurrentPrincipal =
    oldThread's.CurrentPrincipal ,
    it displays the correct Identity.Name in the new Thread, but doesnt actually
    adopt that old principal.

    It moans about logon failure, and won't acually give me access to the Remote
    Share.

    One defffinite Solution is to Change the <processModel userName="..."
    password=".."> tag in machine.config,
    but this causes other problems as I have other WebApps that don't like
    running under another account.
    (and I don't think it's the right way to do it?)



    Is there maybe a way to use one of the ThreadPools Threads for this job?
    or is there a better way to do this?


    Any Ideas?
     
    , Aug 18, 2004
    #1
    1. Advertising

  2. [MSFT] Guest

    I think you may consider call WIN API LogonUser in the code to implement
    the impersonation. It also can make current thread run at a particular
    account. you may refer to following article to see if it will help:

    INFO: Implementing Impersonation in an ASP.NET Application
    http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q306158

    Luke
     
    [MSFT], Aug 19, 2004
    #2
    1. Advertising

  3. Hello,

    How is everything going? If you have any more questions on this issue,
    please feel free to post here and we will follow up.

    Thanks very much.

    Best regards,
    Yanhong Huang
    Microsoft Community Support

    Get Secure! ┬ĘC www.microsoft.com/security
    Register to Access MSDN Managed Newsgroups!
    -http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.as
    p&SD=msdn

    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Yan-Hong Huang[MSFT], Aug 23, 2004
    #3
    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. Jon Paugh
    Replies:
    0
    Views:
    401
    Jon Paugh
    Jan 22, 2004
  2. Ken
    Replies:
    2
    Views:
    2,856
  3. Brian Stoop
    Replies:
    1
    Views:
    411
    Brian Stoop
    May 9, 2008
  4. Dune88
    Replies:
    0
    Views:
    336
    Dune88
    Oct 10, 2008
  5. Michael Ames

    HttpContext.Current.User vs. Thread.CurrentPrincipal

    Michael Ames, Nov 13, 2003, in forum: ASP .Net Security
    Replies:
    1
    Views:
    365
    Ram Sunkara [msft]
    Nov 14, 2003
Loading...

Share This Page