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. HttpWebRequest authentication problem

HttpWebRequest authentication problem

Scheduled Pinned Locked Moved ASP.NET
securityhelpquestioncsharpasp-net
6 Posts 4 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.
  • C Offline
    C Offline
    candogu
    wrote on last edited by
    #1

    Hello, I am trying to make an ASP.NET application that uploads a file to a server on a domain. When I provide my username and password to the application, I can upload but, I need to use credentials who uses the web application that time. I am using HttpWebRequest object and tried CredentialCache.DefaultCredentials but it didn't work. Because of security rules in my company, I have to exclude passwords in my app. How do I get NetworkCredentials of the current user? I couldn't find any solutions? Please help. Thanks, Can DOĞU.

    Z J F 3 Replies Last reply
    0
    • C candogu

      Hello, I am trying to make an ASP.NET application that uploads a file to a server on a domain. When I provide my username and password to the application, I can upload but, I need to use credentials who uses the web application that time. I am using HttpWebRequest object and tried CredentialCache.DefaultCredentials but it didn't work. Because of security rules in my company, I have to exclude passwords in my app. How do I get NetworkCredentials of the current user? I couldn't find any solutions? Please help. Thanks, Can DOĞU.

      Z Offline
      Z Offline
      ZurdoDev
      wrote on last edited by
      #2

      candogu wrote:

      How do I get NetworkCredentials of the current user?

      Look into impersonation, Using IIS Authentication with ASP.NET Impersonation[^].

      There are only 10 types of people in the world, those who understand binary and those who don't.

      C 1 Reply Last reply
      0
      • Z ZurdoDev

        candogu wrote:

        How do I get NetworkCredentials of the current user?

        Look into impersonation, Using IIS Authentication with ASP.NET Impersonation[^].

        There are only 10 types of people in the world, those who understand binary and those who don't.

        C Offline
        C Offline
        candogu
        wrote on last edited by
        #3

        My WebConfig file is like this. There is no difference. Thanks.

        Z 1 Reply Last reply
        0
        • C candogu

          Hello, I am trying to make an ASP.NET application that uploads a file to a server on a domain. When I provide my username and password to the application, I can upload but, I need to use credentials who uses the web application that time. I am using HttpWebRequest object and tried CredentialCache.DefaultCredentials but it didn't work. Because of security rules in my company, I have to exclude passwords in my app. How do I get NetworkCredentials of the current user? I couldn't find any solutions? Please help. Thanks, Can DOĞU.

          J Offline
          J Offline
          John C Rayan
          wrote on last edited by
          #4

          You should be able get the identity using

          HttpContext.Current.User.Identity

          1 Reply Last reply
          0
          • C candogu

            My WebConfig file is like this. There is no difference. Thanks.

            Z Offline
            Z Offline
            ZurdoDev
            wrote on last edited by
            #5

            If your code is impersonating the user and the user is authenticated via Windows Authentication then your code is executing as that user.

            There are only 10 types of people in the world, those who understand binary and those who don't.

            1 Reply Last reply
            0
            • C candogu

              Hello, I am trying to make an ASP.NET application that uploads a file to a server on a domain. When I provide my username and password to the application, I can upload but, I need to use credentials who uses the web application that time. I am using HttpWebRequest object and tried CredentialCache.DefaultCredentials but it didn't work. Because of security rules in my company, I have to exclude passwords in my app. How do I get NetworkCredentials of the current user? I couldn't find any solutions? Please help. Thanks, Can DOĞU.

              F Offline
              F Offline
              F ES Sitecore
              wrote on last edited by
              #6

              The fact that you need to enter credentials (assuming in a pop-up box) shows that basic authentication is being used. As mentioned you need to use Windows Authentication\Impersonation....it varies depending on your version of IIS. It won't work on all browsers\network configurations though so it's hard to know if you just don't have it configured, or if your particular situation doesn't allow it. Google for more info.

              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