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. A problem when using HttpWebRequest

A problem when using HttpWebRequest

Scheduled Pinned Locked Moved ASP.NET
csharpcomsysadminhelpquestion
3 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.
  • R Offline
    R Offline
    Robert Wang1983
    wrote on last edited by
    #1

    private string GetWebContent() { string fullpath = @"http://www.google.com"; HttpWebRequest webreq = (HttpWebRequest)System.Net.WebRequest.Create(fullpath); HttpWebResponse webresp = (HttpWebResponse)webreq.GetResponse(); StreamReader strm = new StreamReader(webresp.GetResponseStream(), Encoding.ASCII); String text = strm.ReadToEnd(); strm.Close(); return text; } This is my code. it works well on my own computer, but when i put in my office computer, there is a WebException: "The underlying connection was closed: Unable to connect to the remote server." why? is it because the setting of firewall in the office server or something. Thanks very much:laugh:

    V 1 Reply Last reply
    0
    • R Robert Wang1983

      private string GetWebContent() { string fullpath = @"http://www.google.com"; HttpWebRequest webreq = (HttpWebRequest)System.Net.WebRequest.Create(fullpath); HttpWebResponse webresp = (HttpWebResponse)webreq.GetResponse(); StreamReader strm = new StreamReader(webresp.GetResponseStream(), Encoding.ASCII); String text = strm.ReadToEnd(); strm.Close(); return text; } This is my code. it works well on my own computer, but when i put in my office computer, there is a WebException: "The underlying connection was closed: Unable to connect to the remote server." why? is it because the setting of firewall in the office server or something. Thanks very much:laugh:

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #2

      It uses system IE settings. Are you able to use google.com in your office computer. And IE profiles might interfere too. :)

      Vasudevan Deepak Kumar Personal Homepage namespace LavanyaDeepak
      Personal Weblog
      The World of Deepak and Lavanya
      Views and Reviews

      R 1 Reply Last reply
      0
      • V Vasudevan Deepak Kumar

        It uses system IE settings. Are you able to use google.com in your office computer. And IE profiles might interfere too. :)

        Vasudevan Deepak Kumar Personal Homepage namespace LavanyaDeepak
        Personal Weblog
        The World of Deepak and Lavanya
        Views and Reviews

        R Offline
        R Offline
        Robert Wang1983
        wrote on last edited by
        #3

        Thanks. i can use www.google.com in my office computer through IE. and i do not understand "And IE profiles might interfere too" could you explain it for me, and how to fix it then? :(

        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