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 Errors

Impersonation Errors

Scheduled Pinned Locked Moved ASP.NET
sysadmintoolsquestion
7 Posts 5 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.
  • J Offline
    J Offline
    Joshua Lunsford
    wrote on last edited by
    #1

    I want impersonation turned on in my web application so the users domain credentials get used to access network resources. in my web.config I added: It worked on my localhost on my dev box. I copied it to the web server and it failed. Errors reported that it couldn't see the shares it was trying reach which needed impersonation to function. I remote desktoped into the webserver and tried to view it on localhost and it worked! So what more can I do to resolve impersonations when the user isnt on the local machine? The only code in use that needs the impersonation is a File.Copy(@"\\server\share$\file.txt", Server.MapPath(Request.ServerVariables["SCRIPT_MAP"]+@"\mynewfile.txt"), true); -- modified at 11:39 Monday 5th December, 2005

    T D M 3 Replies Last reply
    0
    • J Joshua Lunsford

      I want impersonation turned on in my web application so the users domain credentials get used to access network resources. in my web.config I added: It worked on my localhost on my dev box. I copied it to the web server and it failed. Errors reported that it couldn't see the shares it was trying reach which needed impersonation to function. I remote desktoped into the webserver and tried to view it on localhost and it worked! So what more can I do to resolve impersonations when the user isnt on the local machine? The only code in use that needs the impersonation is a File.Copy(@"\\server\share$\file.txt", Server.MapPath(Request.ServerVariables["SCRIPT_MAP"]+@"\mynewfile.txt"), true); -- modified at 11:39 Monday 5th December, 2005

      T Offline
      T Offline
      ToddHileHoffer
      wrote on last edited by
      #2

      Did you grant the account that is running asp_net service access to the directory? "People who never make mistakes, never do anything." My Blog

      J 1 Reply Last reply
      0
      • J Joshua Lunsford

        I want impersonation turned on in my web application so the users domain credentials get used to access network resources. in my web.config I added: It worked on my localhost on my dev box. I copied it to the web server and it failed. Errors reported that it couldn't see the shares it was trying reach which needed impersonation to function. I remote desktoped into the webserver and tried to view it on localhost and it worked! So what more can I do to resolve impersonations when the user isnt on the local machine? The only code in use that needs the impersonation is a File.Copy(@"\\server\share$\file.txt", Server.MapPath(Request.ServerVariables["SCRIPT_MAP"]+@"\mynewfile.txt"), true); -- modified at 11:39 Monday 5th December, 2005

        D Offline
        D Offline
        Daniel Santillanes
        wrote on last edited by
        #3

        If I remember correctly, you shouldn't use anonymous logon, and leave Windows authentication set. In the project where I worked, we needed to use basic authentication as well, so when the user tried to enter the site, they were requested their login/password pair to access, not a login page but the login asked by internet explorer itself. Hope this helps. daniero

        J 1 Reply Last reply
        0
        • T ToddHileHoffer

          Did you grant the account that is running asp_net service access to the directory? "People who never make mistakes, never do anything." My Blog

          J Offline
          J Offline
          Joshua Lunsford
          wrote on last edited by
          #4

          im avoiding using the local machines aspnet service account because it doesn't have premissions out in the enterprise domain and I could never talk the IT security guys into adding it. Thats why I was trying to turn impersonate on. but doesn't do it. but does work. But I dont really want it using my premissions coded in there... I want it to use the current users credentials -- modified at 19:45 Monday 5th December, 2005

          1 Reply Last reply
          0
          • D Daniel Santillanes

            If I remember correctly, you shouldn't use anonymous logon, and leave Windows authentication set. In the project where I worked, we needed to use basic authentication as well, so when the user tried to enter the site, they were requested their login/password pair to access, not a login page but the login asked by internet explorer itself. Hope this helps. daniero

            J Offline
            J Offline
            Joshua Lunsford
            wrote on last edited by
            #5

            i dont use anonymous... They have to be in a certain group to even reach the site. So I have it set for windows auth similar to the following.

            M 1 Reply Last reply
            0
            • J Joshua Lunsford

              I want impersonation turned on in my web application so the users domain credentials get used to access network resources. in my web.config I added: It worked on my localhost on my dev box. I copied it to the web server and it failed. Errors reported that it couldn't see the shares it was trying reach which needed impersonation to function. I remote desktoped into the webserver and tried to view it on localhost and it worked! So what more can I do to resolve impersonations when the user isnt on the local machine? The only code in use that needs the impersonation is a File.Copy(@"\\server\share$\file.txt", Server.MapPath(Request.ServerVariables["SCRIPT_MAP"]+@"\mynewfile.txt"), true); -- modified at 11:39 Monday 5th December, 2005

              M Offline
              M Offline
              minhpc_bk
              wrote on last edited by
              #6

              Hi there, IMHO, you may try using the sample code below to get the current account that your ASP.NET application is impersonating and check if it has enough permissions.

              System.Security.Principal.WindowsIdentity.GetCurrent().Name

              For more information, you can see http://support.microsoft.com/kb/306158/[^]

              1 Reply Last reply
              0
              • J Joshua Lunsford

                i dont use anonymous... They have to be in a certain group to even reach the site. So I have it set for windows auth similar to the following.

                M Offline
                M Offline
                Marcus J Smith
                wrote on last edited by
                #7

                One problem with that authorization is that it is saying allow users instead of allow roles also you should use deny users="?" so that it denies anyone that isnt authorized, saying deny users="*" will deny everybody. There is some work that needs to be done to allow the web server to pass that authenticated user account across after you gain access to the page. That will need to be a question for a server admin. There is the whole 2 hop rule which means that the server is not setup to delegate the user account forward. I hope this helps some. Cleako

                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