Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. How to Impersonate from Credential

How to Impersonate from Credential

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharptutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Saravanakumar K
    wrote on last edited by
    #1

    I have to Impersonate my windowsApplication (C#) to the Credential (which will be send by user).. Give below is my same function (Which wont work) what i need. public class clsImpersonate{ public void Impersonate(ICredential UserCredential){ WindowsIdentity newId = (WindowsIdentity)UserCredential; WindowsImpersonationContext impersonatedUser = newId.Impersonate(); MessageBox.Show(WindowsIdentity.GetCurrent().Name); } } I will call the function like below.. public static void mail(){ clsImpersonate objImp = new clsImpersonate(); ICredentials NWC = System.Net.CredentialCache.DefaultCredentials; objImp.Impersonate(NWC); } But above code is wrong because we can not typecast from Icredential to WinndowsIdentity. Is there any other way to do the same. Thanks Saravanakumar.K India

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups