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

HttpWebRequest

Scheduled Pinned Locked Moved ASP.NET
csharphelpquestionsysadmindata-structures
2 Posts 2 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.
  • A Offline
    A Offline
    Ayman Mashal
    wrote on last edited by
    #1

    Hi , i am trying to retreive an xml doc from another server on the same domain where my computer resides i am using HttpWebRequest from c# code but i am getting the below error how can i solve this problem without hardcoding a user name and password in the code ? thanks

    The remote server returned an error: (401) Unauthorized.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Net.WebException: The remote server returned an error: (401) Unauthorized.

    Source Error:

    Line 41:
    Line 42: //From here on, it's all the same as above.
    Line 43: HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
    Line 44: //Let's show some information about the response
    Line 45: Console.WriteLine(WebResp.StatusCode);

    T 1 Reply Last reply
    0
    • A Ayman Mashal

      Hi , i am trying to retreive an xml doc from another server on the same domain where my computer resides i am using HttpWebRequest from c# code but i am getting the below error how can i solve this problem without hardcoding a user name and password in the code ? thanks

      The remote server returned an error: (401) Unauthorized.
      Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

      Exception Details: System.Net.WebException: The remote server returned an error: (401) Unauthorized.

      Source Error:

      Line 41:
      Line 42: //From here on, it's all the same as above.
      Line 43: HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
      Line 44: //Let's show some information about the response
      Line 45: Console.WriteLine(WebResp.StatusCode);

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

      Allow anonymous to the page you are requesting...

      I didn't get any requirements for the signature

      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