HttpWebRequest returning 404 when page exists

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ThatsIT.net.au

    HttpWebRequest returning 404 when page exists

    I'm getting a 404 error when I shouldn't, the page exists

    the error is
    The remote server returned an error: (404) Not Found.

    the status is 7 witch equates to WebExceptionSta tus.ProtocolErr or

    I have the same web site on my production server but when loaded on my live
    server it errors.

    both servers are the same setup as far as I can remember I have nothing
    different

    win 2003 web server behind a win 2000 sbs server with ISA 2000

    pages is on same site in same directory, code is below and url is correct.

    any ideas






    Dim sn As String = Request.ServerV ariables("SERVE R_NAME")

    Dim wr As WebResponse = HttpWebRequest. Create("http://" & sn &
    "/contact/email.aspx").Ge tResponse
    Dim sr As StreamReader = New StreamReader(wr .GetResponseStr eam())

    Dim replyBody As String = sr.ReadToEnd

  • ThatsIT.net.au

    #2
    Re: HttpWebRequest returning 404 when page exists

    Like so many times as soon as I post my problem the solution comes to me.

    In my case it is because I have a second domain name pointing to the server
    and using the server variable to get the server name gets a domain name that
    is not included in the internal dns so it does not resole internally.



    "ThatsIT.net.au " <me@workwrote in message
    news:88B16342-5030-405E-99D9-1411C398CEA6@mi crosoft.com...
    I'm getting a 404 error when I shouldn't, the page exists
    >
    the error is
    The remote server returned an error: (404) Not Found.
    >
    the status is 7 witch equates to WebExceptionSta tus.ProtocolErr or
    >
    I have the same web site on my production server but when loaded on my
    live server it errors.
    >
    both servers are the same setup as far as I can remember I have nothing
    different
    >
    win 2003 web server behind a win 2000 sbs server with ISA 2000
    >
    pages is on same site in same directory, code is below and url is correct.
    >
    any ideas
    >
    >
    >
    >
    >
    >
    Dim sn As String = Request.ServerV ariables("SERVE R_NAME")
    >
    Dim wr As WebResponse = HttpWebRequest. Create("http://" & sn &
    "/contact/email.aspx").Ge tResponse
    Dim sr As StreamReader = New StreamReader(wr .GetResponseStr eam())
    >
    Dim replyBody As String = sr.ReadToEnd

    Comment

    Working...