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
  1. Home
  2. Web Development
  3. ASP.NET
  4. Impersonation ???

Impersonation ???

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-netsysadmindebugging
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.
  • B Offline
    B Offline
    Bill Dean
    wrote on last edited by
    #1

    Hi all, Appologies in advance if this question has already been answered...I looked...really! Apparently I don't know jack about impersonation in ASP.NET. I need to have ASP.NET look at a network share and tell me if it finds a file. My code looks like: //impersonate int i; bool b=LogonUser("someuser","RESTEKCORP","thepassword",3,0,out i ); WindowsIdentity wi = new WindowsIdentity (new System.IntPtr (i)); WindowsImpersonationContext wic = wi.Impersonate (); FileInfo FI = new FileInfo (@"\\10.238.218.XXX/some_share/TheFile.ext"); Now my confussion: I know "someuser" has access to the share, since I use my own login (at least for now) and I can list the directory and edit files through windows. The login seems to succeed, as b is true. But FI.Exists comes back as false, even though I know the file exists. So I look at FI in the debugger and notice that I am getting a message saying that a System.UnauthorizedAccessException occured. Which suggests to me that the impersonation is not working... What am I missing? Bill

    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