Professional Web Applications Themes

HttpWebRequest.GetResponse returns 404 No Found error - ASP.NET Web Services

I have a windows client app that is trying to download a file from a web server but I always get the following error when I call the GetResponse method of the Request object. The remote server returned an error: (404) Not Found. When I run it against a website on my local machine everything works perfectly, but not against the remote server. I'm sure it's a security or permissions problem of some sort, but I'm not sure where to start. The code I'm using is below. Thanks in advance for any help. Cameron HttpWebResponse Response; //Retrieve the File HttpWebRequest ...

  1. #1

    Default HttpWebRequest.GetResponse returns 404 No Found error

    I have a windows client app that is trying to download a file from
    a web server but I always get the following error when I call the
    GetResponse method of the Request object.

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

    When I run it against a website on my local machine everything works
    perfectly, but not against the remote server. I'm sure it's a security
    or permissions problem of some sort, but I'm not sure where to start.

    The code I'm using is below.

    Thanks in advance for any help.

    Cameron


    HttpWebResponse Response;

    //Retrieve the File
    HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(url);
    Request.Headers.Add("Translate: f");
    Request.Credentials = CredentialCache.DefaultCredentials;

    try
    {
    Response = (HttpWebResponse)Request.GetResponse();
    }
    catch(WebException e)
    {
    //Handle the exception here
    }
    finally
    {
    Response.Close()
    }


    warlord Guest

  2. #2

    Default HttpWebRequest.GetResponse returns 404 No Found error

    I have a windows client app that is trying to download a file from
    a web server but I always get the following error when I call the
    GetResponse method of the Request object.

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

    When I run it against a website on my local machine everything works
    perfectly, but not against the remote server. I'm sure it's a security
    or permissions problem of some sort, but I'm not sure where to start.

    The code I'm using is below.

    Thanks in advance for any help.

    Cameron


    HttpWebResponse Response;

    //Retrieve the File
    HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(url);
    Request.Headers.Add("Translate: f");
    Request.Credentials = CredentialCache.DefaultCredentials;

    try
    {
    Response = (HttpWebResponse)Request.GetResponse();
    }
    catch(WebException e)
    {
    //Handle the exception here
    }
    finally
    {
    Response.Close()
    }


    warlord Guest

  3. #3

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    Is the remote server an IIS 6.0 box? If so, is WebDAV enabled?
    Does the URL requested actually exist?

    Cheers
    Ken

    "warlord" <smuffnstuffhotmail.com> wrote in message
    news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    : I have a windows client app that is trying to download a file from
    : a web server but I always get the following error when I call the
    : GetResponse method of the Request object.
    :
    : The remote server returned an error: (404) Not Found.
    :
    : When I run it against a website on my local machine everything works
    : perfectly, but not against the remote server. I'm sure it's a security
    : or permissions problem of some sort, but I'm not sure where to start.
    :
    : The code I'm using is below.
    :
    : Thanks in advance for any help.
    :
    : Cameron
    :
    :
    : HttpWebResponse Response;
    :
    : //Retrieve the File
    : HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(url);
    : Request.Headers.Add("Translate: f");
    : Request.Credentials = CredentialCache.DefaultCredentials;
    :
    : try
    : {
    : Response = (HttpWebResponse)Request.GetResponse();
    : }
    : catch(WebException e)
    : {
    : //Handle the exception here
    : }
    : finally
    : {
    : Response.Close()
    : }
    :
    :


    Ken Schaefer Guest

  4. #4

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    Is the remote server an IIS 6.0 box? If so, is WebDAV enabled?
    Does the URL requested actually exist?

    Cheers
    Ken

    "warlord" <smuffnstuffhotmail.com> wrote in message
    news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    : I have a windows client app that is trying to download a file from
    : a web server but I always get the following error when I call the
    : GetResponse method of the Request object.
    :
    : The remote server returned an error: (404) Not Found.
    :
    : When I run it against a website on my local machine everything works
    : perfectly, but not against the remote server. I'm sure it's a security
    : or permissions problem of some sort, but I'm not sure where to start.
    :
    : The code I'm using is below.
    :
    : Thanks in advance for any help.
    :
    : Cameron
    :
    :
    : HttpWebResponse Response;
    :
    : //Retrieve the File
    : HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(url);
    : Request.Headers.Add("Translate: f");
    : Request.Credentials = CredentialCache.DefaultCredentials;
    :
    : try
    : {
    : Response = (HttpWebResponse)Request.GetResponse();
    : }
    : catch(WebException e)
    : {
    : //Handle the exception here
    : }
    : finally
    : {
    : Response.Close()
    : }
    :
    :


    Ken Schaefer Guest

  5. #5

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    The web server is IIS 5.0, and the Url does exist. I can get to it via a
    browser without any problems - it's just from within the windows app that it
    isn't accessible.

    Cheers,

    Cameron

    "Ken Schaefer" <kenREMOVETHISadOpenStatic.com> wrote in message
    news:eDA1pp6FEHA.2052TK2MSFTNGP11.phx.gbl...
    > Is the remote server an IIS 6.0 box? If so, is WebDAV enabled?
    > Does the URL requested actually exist?
    >
    > Cheers
    > Ken
    >
    > "warlord" <smuffnstuffhotmail.com> wrote in message
    > news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    > : I have a windows client app that is trying to download a file from
    > : a web server but I always get the following error when I call the
    > : GetResponse method of the Request object.
    > :
    > : The remote server returned an error: (404) Not Found.
    > :
    > : When I run it against a website on my local machine everything works
    > : perfectly, but not against the remote server. I'm sure it's a security
    > : or permissions problem of some sort, but I'm not sure where to start.
    > :
    > : The code I'm using is below.
    > :
    > : Thanks in advance for any help.
    > :
    > : Cameron
    > :
    > :
    > : HttpWebResponse Response;
    > :
    > : //Retrieve the File
    > : HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(url);
    > : Request.Headers.Add("Translate: f");
    > : Request.Credentials = CredentialCache.DefaultCredentials;
    > :
    > : try
    > : {
    > : Response = (HttpWebResponse)Request.GetResponse();
    > : }
    > : catch(WebException e)
    > : {
    > : //Handle the exception here
    > : }
    > : finally
    > : {
    > : Response.Close()
    > : }
    > :
    > :
    >
    >

    warlord Guest

  6. #6

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    The web server is IIS 5.0, and the Url does exist. I can get to it via a
    browser without any problems - it's just from within the windows app that it
    isn't accessible.

    Cheers,

    Cameron

    "Ken Schaefer" <kenREMOVETHISadOpenStatic.com> wrote in message
    news:eDA1pp6FEHA.2052TK2MSFTNGP11.phx.gbl...
    > Is the remote server an IIS 6.0 box? If so, is WebDAV enabled?
    > Does the URL requested actually exist?
    >
    > Cheers
    > Ken
    >
    > "warlord" <smuffnstuffhotmail.com> wrote in message
    > news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    > : I have a windows client app that is trying to download a file from
    > : a web server but I always get the following error when I call the
    > : GetResponse method of the Request object.
    > :
    > : The remote server returned an error: (404) Not Found.
    > :
    > : When I run it against a website on my local machine everything works
    > : perfectly, but not against the remote server. I'm sure it's a security
    > : or permissions problem of some sort, but I'm not sure where to start.
    > :
    > : The code I'm using is below.
    > :
    > : Thanks in advance for any help.
    > :
    > : Cameron
    > :
    > :
    > : HttpWebResponse Response;
    > :
    > : //Retrieve the File
    > : HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(url);
    > : Request.Headers.Add("Translate: f");
    > : Request.Credentials = CredentialCache.DefaultCredentials;
    > :
    > : try
    > : {
    > : Response = (HttpWebResponse)Request.GetResponse();
    > : }
    > : catch(WebException e)
    > : {
    > : //Handle the exception here
    > : }
    > : finally
    > : {
    > : Response.Close()
    > : }
    > :
    > :
    >
    >

    warlord Guest

  7. #7

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    Could it be that you go through a proxy server normally, and your windows
    app is not providing the proxy credentials?

    --
    Regards

    John Timney
    Microsoft Regional Director
    Microsoft MVP


    "warlord" <smuffnstuffhotmail.com> wrote in message
    news:e$wySA7FEHA.1240TK2MSFTNGP10.phx.gbl...
    > The web server is IIS 5.0, and the Url does exist. I can get to it via a
    > browser without any problems - it's just from within the windows app that
    it
    > isn't accessible.
    >
    > Cheers,
    >
    > Cameron
    >
    > "Ken Schaefer" <kenREMOVETHISadOpenStatic.com> wrote in message
    > news:eDA1pp6FEHA.2052TK2MSFTNGP11.phx.gbl...
    > > Is the remote server an IIS 6.0 box? If so, is WebDAV enabled?
    > > Does the URL requested actually exist?
    > >
    > > Cheers
    > > Ken
    > >
    > > "warlord" <smuffnstuffhotmail.com> wrote in message
    > > news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    > > : I have a windows client app that is trying to download a file from
    > > : a web server but I always get the following error when I call the
    > > : GetResponse method of the Request object.
    > > :
    > > : The remote server returned an error: (404) Not Found.
    > > :
    > > : When I run it against a website on my local machine everything works
    > > : perfectly, but not against the remote server. I'm sure it's a
    security
    > > : or permissions problem of some sort, but I'm not sure where to start.
    > > :
    > > : The code I'm using is below.
    > > :
    > > : Thanks in advance for any help.
    > > :
    > > : Cameron
    > > :
    > > :
    > > : HttpWebResponse Response;
    > > :
    > > : //Retrieve the File
    > > : HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(url);
    > > : Request.Headers.Add("Translate: f");
    > > : Request.Credentials = CredentialCache.DefaultCredentials;
    > > :
    > > : try
    > > : {
    > > : Response = (HttpWebResponse)Request.GetResponse();
    > > : }
    > > : catch(WebException e)
    > > : {
    > > : //Handle the exception here
    > > : }
    > > : finally
    > > : {
    > > : Response.Close()
    > > : }
    > > :
    > > :
    > >
    > >
    >
    >

    John Timney \(Microsoft MVP\) Guest

  8. #8

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    Could it be that you go through a proxy server normally, and your windows
    app is not providing the proxy credentials?

    --
    Regards

    John Timney
    Microsoft Regional Director
    Microsoft MVP


    "warlord" <smuffnstuffhotmail.com> wrote in message
    news:e$wySA7FEHA.1240TK2MSFTNGP10.phx.gbl...
    > The web server is IIS 5.0, and the Url does exist. I can get to it via a
    > browser without any problems - it's just from within the windows app that
    it
    > isn't accessible.
    >
    > Cheers,
    >
    > Cameron
    >
    > "Ken Schaefer" <kenREMOVETHISadOpenStatic.com> wrote in message
    > news:eDA1pp6FEHA.2052TK2MSFTNGP11.phx.gbl...
    > > Is the remote server an IIS 6.0 box? If so, is WebDAV enabled?
    > > Does the URL requested actually exist?
    > >
    > > Cheers
    > > Ken
    > >
    > > "warlord" <smuffnstuffhotmail.com> wrote in message
    > > news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    > > : I have a windows client app that is trying to download a file from
    > > : a web server but I always get the following error when I call the
    > > : GetResponse method of the Request object.
    > > :
    > > : The remote server returned an error: (404) Not Found.
    > > :
    > > : When I run it against a website on my local machine everything works
    > > : perfectly, but not against the remote server. I'm sure it's a
    security
    > > : or permissions problem of some sort, but I'm not sure where to start.
    > > :
    > > : The code I'm using is below.
    > > :
    > > : Thanks in advance for any help.
    > > :
    > > : Cameron
    > > :
    > > :
    > > : HttpWebResponse Response;
    > > :
    > > : //Retrieve the File
    > > : HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(url);
    > > : Request.Headers.Add("Translate: f");
    > > : Request.Credentials = CredentialCache.DefaultCredentials;
    > > :
    > > : try
    > > : {
    > > : Response = (HttpWebResponse)Request.GetResponse();
    > > : }
    > > : catch(WebException e)
    > > : {
    > > : //Handle the exception here
    > > : }
    > > : finally
    > > : {
    > > : Response.Close()
    > > : }
    > > :
    > > :
    > >
    > >
    >
    >

    John Timney \(Microsoft MVP\) Guest

  9. #9

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    The browser reports the HTTP_REFERRER to the server.
    And a lot of servers prevent downloading images if HTTP_REFERRER points to
    different server name.

    Thus preventing so called "hotlinking". When someone else site links to the
    images that reside on someone else's server.

    So they do not need to pay for bandwidth.

    George.


    "warlord" <smuffnstuffhotmail.com> wrote in message
    news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    > I have a windows client app that is trying to download a file from
    > a web server but I always get the following error when I call the
    > GetResponse method of the Request object.
    >
    > The remote server returned an error: (404) Not Found.
    >
    > When I run it against a website on my local machine everything works
    > perfectly, but not against the remote server. I'm sure it's a security
    > or permissions problem of some sort, but I'm not sure where to start.
    >
    > The code I'm using is below.
    >
    > Thanks in advance for any help.
    >
    > Cameron
    >
    >
    > HttpWebResponse Response;
    >
    > //Retrieve the File
    > HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(url);
    > Request.Headers.Add("Translate: f");
    > Request.Credentials = CredentialCache.DefaultCredentials;
    >
    > try
    > {
    > Response = (HttpWebResponse)Request.GetResponse();
    > }
    > catch(WebException e)
    > {
    > //Handle the exception here
    > }
    > finally
    > {
    > Response.Close()
    > }
    >
    >

    George Ter-Saakov Guest

  10. #10

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    The browser reports the HTTP_REFERRER to the server.
    And a lot of servers prevent downloading images if HTTP_REFERRER points to
    different server name.

    Thus preventing so called "hotlinking". When someone else site links to the
    images that reside on someone else's server.

    So they do not need to pay for bandwidth.

    George.


    "warlord" <smuffnstuffhotmail.com> wrote in message
    news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    > I have a windows client app that is trying to download a file from
    > a web server but I always get the following error when I call the
    > GetResponse method of the Request object.
    >
    > The remote server returned an error: (404) Not Found.
    >
    > When I run it against a website on my local machine everything works
    > perfectly, but not against the remote server. I'm sure it's a security
    > or permissions problem of some sort, but I'm not sure where to start.
    >
    > The code I'm using is below.
    >
    > Thanks in advance for any help.
    >
    > Cameron
    >
    >
    > HttpWebResponse Response;
    >
    > //Retrieve the File
    > HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(url);
    > Request.Headers.Add("Translate: f");
    > Request.Credentials = CredentialCache.DefaultCredentials;
    >
    > try
    > {
    > Response = (HttpWebResponse)Request.GetResponse();
    > }
    > catch(WebException e)
    > {
    > //Handle the exception here
    > }
    > finally
    > {
    > Response.Close()
    > }
    >
    >

    George Ter-Saakov Guest

  11. #11

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    I thought that might be the case, but I'm providing the proxy credentials
    and still no joy. In fact, I get the same error whether I provide them or
    not, and when I run everything locally it works whether I provide the proxy
    credntials or not.

    Regards,

    Cameron

    "John Timney (Microsoft MVP)" <timneyjdespammed.com> wrote in message
    news:ekIhJfBGEHA.700TK2MSFTNGP09.phx.gbl...
    > Could it be that you go through a proxy server normally, and your windows
    > app is not providing the proxy credentials?
    >
    > --
    > Regards
    >
    > John Timney
    > Microsoft Regional Director
    > Microsoft MVP
    >
    >
    > "warlord" <smuffnstuffhotmail.com> wrote in message
    > news:e$wySA7FEHA.1240TK2MSFTNGP10.phx.gbl...
    > > The web server is IIS 5.0, and the Url does exist. I can get to it via
    a
    > > browser without any problems - it's just from within the windows app
    that
    > it
    > > isn't accessible.
    > >
    > > Cheers,
    > >
    > > Cameron
    > >
    > > "Ken Schaefer" <kenREMOVETHISadOpenStatic.com> wrote in message
    > > news:eDA1pp6FEHA.2052TK2MSFTNGP11.phx.gbl...
    > > > Is the remote server an IIS 6.0 box? If so, is WebDAV enabled?
    > > > Does the URL requested actually exist?
    > > >
    > > > Cheers
    > > > Ken
    > > >
    > > > "warlord" <smuffnstuffhotmail.com> wrote in message
    > > > news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    > > > : I have a windows client app that is trying to download a file from
    > > > : a web server but I always get the following error when I call the
    > > > : GetResponse method of the Request object.
    > > > :
    > > > : The remote server returned an error: (404) Not Found.
    > > > :
    > > > : When I run it against a website on my local machine everything works
    > > > : perfectly, but not against the remote server. I'm sure it's a
    > security
    > > > : or permissions problem of some sort, but I'm not sure where to
    start.
    > > > :
    > > > : The code I'm using is below.
    > > > :
    > > > : Thanks in advance for any help.
    > > > :
    > > > : Cameron
    > > > :
    > > > :
    > > > : HttpWebResponse Response;
    > > > :
    > > > : //Retrieve the File
    > > > : HttpWebRequest Request =
    (HttpWebRequest)HttpWebRequest.Create(url);
    > > > : Request.Headers.Add("Translate: f");
    > > > : Request.Credentials = CredentialCache.DefaultCredentials;
    > > > :
    > > > : try
    > > > : {
    > > > : Response = (HttpWebResponse)Request.GetResponse();
    > > > : }
    > > > : catch(WebException e)
    > > > : {
    > > > : //Handle the exception here
    > > > : }
    > > > : finally
    > > > : {
    > > > : Response.Close()
    > > > : }
    > > > :
    > > > :
    > > >
    > > >
    > >
    > >
    >
    >

    warlord Guest

  12. #12

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    I thought that might be the case, but I'm providing the proxy credentials
    and still no joy. In fact, I get the same error whether I provide them or
    not, and when I run everything locally it works whether I provide the proxy
    credntials or not.

    Regards,

    Cameron

    "John Timney (Microsoft MVP)" <timneyjdespammed.com> wrote in message
    news:ekIhJfBGEHA.700TK2MSFTNGP09.phx.gbl...
    > Could it be that you go through a proxy server normally, and your windows
    > app is not providing the proxy credentials?
    >
    > --
    > Regards
    >
    > John Timney
    > Microsoft Regional Director
    > Microsoft MVP
    >
    >
    > "warlord" <smuffnstuffhotmail.com> wrote in message
    > news:e$wySA7FEHA.1240TK2MSFTNGP10.phx.gbl...
    > > The web server is IIS 5.0, and the Url does exist. I can get to it via
    a
    > > browser without any problems - it's just from within the windows app
    that
    > it
    > > isn't accessible.
    > >
    > > Cheers,
    > >
    > > Cameron
    > >
    > > "Ken Schaefer" <kenREMOVETHISadOpenStatic.com> wrote in message
    > > news:eDA1pp6FEHA.2052TK2MSFTNGP11.phx.gbl...
    > > > Is the remote server an IIS 6.0 box? If so, is WebDAV enabled?
    > > > Does the URL requested actually exist?
    > > >
    > > > Cheers
    > > > Ken
    > > >
    > > > "warlord" <smuffnstuffhotmail.com> wrote in message
    > > > news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    > > > : I have a windows client app that is trying to download a file from
    > > > : a web server but I always get the following error when I call the
    > > > : GetResponse method of the Request object.
    > > > :
    > > > : The remote server returned an error: (404) Not Found.
    > > > :
    > > > : When I run it against a website on my local machine everything works
    > > > : perfectly, but not against the remote server. I'm sure it's a
    > security
    > > > : or permissions problem of some sort, but I'm not sure where to
    start.
    > > > :
    > > > : The code I'm using is below.
    > > > :
    > > > : Thanks in advance for any help.
    > > > :
    > > > : Cameron
    > > > :
    > > > :
    > > > : HttpWebResponse Response;
    > > > :
    > > > : //Retrieve the File
    > > > : HttpWebRequest Request =
    (HttpWebRequest)HttpWebRequest.Create(url);
    > > > : Request.Headers.Add("Translate: f");
    > > > : Request.Credentials = CredentialCache.DefaultCredentials;
    > > > :
    > > > : try
    > > > : {
    > > > : Response = (HttpWebResponse)Request.GetResponse();
    > > > : }
    > > > : catch(WebException e)
    > > > : {
    > > > : //Handle the exception here
    > > > : }
    > > > : finally
    > > > : {
    > > > : Response.Close()
    > > > : }
    > > > :
    > > > :
    > > >
    > > >
    > >
    > >
    >
    >

    warlord Guest

  13. #13

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    I probably should add that the same windows application calls a web service
    one the server without any problems - it's only trying to get the Response
    stream from a new Request object.

    Cheers,

    Cameron

    "John Timney (Microsoft MVP)" <timneyjdespammed.com> wrote in message
    news:ekIhJfBGEHA.700TK2MSFTNGP09.phx.gbl...
    > Could it be that you go through a proxy server normally, and your windows
    > app is not providing the proxy credentials?
    >
    > --
    > Regards
    >
    > John Timney
    > Microsoft Regional Director
    > Microsoft MVP
    >
    >
    > "warlord" <smuffnstuffhotmail.com> wrote in message
    > news:e$wySA7FEHA.1240TK2MSFTNGP10.phx.gbl...
    > > The web server is IIS 5.0, and the Url does exist. I can get to it via
    a
    > > browser without any problems - it's just from within the windows app
    that
    > it
    > > isn't accessible.
    > >
    > > Cheers,
    > >
    > > Cameron
    > >
    > > "Ken Schaefer" <kenREMOVETHISadOpenStatic.com> wrote in message
    > > news:eDA1pp6FEHA.2052TK2MSFTNGP11.phx.gbl...
    > > > Is the remote server an IIS 6.0 box? If so, is WebDAV enabled?
    > > > Does the URL requested actually exist?
    > > >
    > > > Cheers
    > > > Ken
    > > >
    > > > "warlord" <smuffnstuffhotmail.com> wrote in message
    > > > news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    > > > : I have a windows client app that is trying to download a file from
    > > > : a web server but I always get the following error when I call the
    > > > : GetResponse method of the Request object.
    > > > :
    > > > : The remote server returned an error: (404) Not Found.
    > > > :
    > > > : When I run it against a website on my local machine everything works
    > > > : perfectly, but not against the remote server. I'm sure it's a
    > security
    > > > : or permissions problem of some sort, but I'm not sure where to
    start.
    > > > :
    > > > : The code I'm using is below.
    > > > :
    > > > : Thanks in advance for any help.
    > > > :
    > > > : Cameron
    > > > :
    > > > :
    > > > : HttpWebResponse Response;
    > > > :
    > > > : //Retrieve the File
    > > > : HttpWebRequest Request =
    (HttpWebRequest)HttpWebRequest.Create(url);
    > > > : Request.Headers.Add("Translate: f");
    > > > : Request.Credentials = CredentialCache.DefaultCredentials;
    > > > :
    > > > : try
    > > > : {
    > > > : Response = (HttpWebResponse)Request.GetResponse();
    > > > : }
    > > > : catch(WebException e)
    > > > : {
    > > > : //Handle the exception here
    > > > : }
    > > > : finally
    > > > : {
    > > > : Response.Close()
    > > > : }
    > > > :
    > > > :
    > > >
    > > >
    > >
    > >
    >
    >

    warlord Guest

  14. #14

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    I probably should add that the same windows application calls a web service
    one the server without any problems - it's only trying to get the Response
    stream from a new Request object.

    Cheers,

    Cameron

    "John Timney (Microsoft MVP)" <timneyjdespammed.com> wrote in message
    news:ekIhJfBGEHA.700TK2MSFTNGP09.phx.gbl...
    > Could it be that you go through a proxy server normally, and your windows
    > app is not providing the proxy credentials?
    >
    > --
    > Regards
    >
    > John Timney
    > Microsoft Regional Director
    > Microsoft MVP
    >
    >
    > "warlord" <smuffnstuffhotmail.com> wrote in message
    > news:e$wySA7FEHA.1240TK2MSFTNGP10.phx.gbl...
    > > The web server is IIS 5.0, and the Url does exist. I can get to it via
    a
    > > browser without any problems - it's just from within the windows app
    that
    > it
    > > isn't accessible.
    > >
    > > Cheers,
    > >
    > > Cameron
    > >
    > > "Ken Schaefer" <kenREMOVETHISadOpenStatic.com> wrote in message
    > > news:eDA1pp6FEHA.2052TK2MSFTNGP11.phx.gbl...
    > > > Is the remote server an IIS 6.0 box? If so, is WebDAV enabled?
    > > > Does the URL requested actually exist?
    > > >
    > > > Cheers
    > > > Ken
    > > >
    > > > "warlord" <smuffnstuffhotmail.com> wrote in message
    > > > news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    > > > : I have a windows client app that is trying to download a file from
    > > > : a web server but I always get the following error when I call the
    > > > : GetResponse method of the Request object.
    > > > :
    > > > : The remote server returned an error: (404) Not Found.
    > > > :
    > > > : When I run it against a website on my local machine everything works
    > > > : perfectly, but not against the remote server. I'm sure it's a
    > security
    > > > : or permissions problem of some sort, but I'm not sure where to
    start.
    > > > :
    > > > : The code I'm using is below.
    > > > :
    > > > : Thanks in advance for any help.
    > > > :
    > > > : Cameron
    > > > :
    > > > :
    > > > : HttpWebResponse Response;
    > > > :
    > > > : //Retrieve the File
    > > > : HttpWebRequest Request =
    (HttpWebRequest)HttpWebRequest.Create(url);
    > > > : Request.Headers.Add("Translate: f");
    > > > : Request.Credentials = CredentialCache.DefaultCredentials;
    > > > :
    > > > : try
    > > > : {
    > > > : Response = (HttpWebResponse)Request.GetResponse();
    > > > : }
    > > > : catch(WebException e)
    > > > : {
    > > > : //Handle the exception here
    > > > : }
    > > > : finally
    > > > : {
    > > > : Response.Close()
    > > > : }
    > > > :
    > > > :
    > > >
    > > >
    > >
    > >
    >
    >

    warlord Guest

  15. #15

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    Does the app your calling expect cookies, I'm guessing that your web service
    is stateless but your web app is not. It may be trying to establish a
    session and failing.

    --
    Regards

    John Timney
    Microsoft Regional Director
    Microsoft MVP


    "warlord" <smuffnstuffhotmail.com> wrote in message
    news:Oiqg7BFGEHA.1240TK2MSFTNGP10.phx.gbl...
    > I probably should add that the same windows application calls a web
    service
    > one the server without any problems - it's only trying to get the Response
    > stream from a new Request object.
    >
    > Cheers,
    >
    > Cameron
    >
    > "John Timney (Microsoft MVP)" <timneyjdespammed.com> wrote in message
    > news:ekIhJfBGEHA.700TK2MSFTNGP09.phx.gbl...
    > > Could it be that you go through a proxy server normally, and your
    windows
    > > app is not providing the proxy credentials?
    > >
    > > --
    > > Regards
    > >
    > > John Timney
    > > Microsoft Regional Director
    > > Microsoft MVP
    > >
    > >
    > > "warlord" <smuffnstuffhotmail.com> wrote in message
    > > news:e$wySA7FEHA.1240TK2MSFTNGP10.phx.gbl...
    > > > The web server is IIS 5.0, and the Url does exist. I can get to it
    via
    > a
    > > > browser without any problems - it's just from within the windows app
    > that
    > > it
    > > > isn't accessible.
    > > >
    > > > Cheers,
    > > >
    > > > Cameron
    > > >
    > > > "Ken Schaefer" <kenREMOVETHISadOpenStatic.com> wrote in message
    > > > news:eDA1pp6FEHA.2052TK2MSFTNGP11.phx.gbl...
    > > > > Is the remote server an IIS 6.0 box? If so, is WebDAV enabled?
    > > > > Does the URL requested actually exist?
    > > > >
    > > > > Cheers
    > > > > Ken
    > > > >
    > > > > "warlord" <smuffnstuffhotmail.com> wrote in message
    > > > > news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    > > > > : I have a windows client app that is trying to download a file from
    > > > > : a web server but I always get the following error when I call the
    > > > > : GetResponse method of the Request object.
    > > > > :
    > > > > : The remote server returned an error: (404) Not Found.
    > > > > :
    > > > > : When I run it against a website on my local machine everything
    works
    > > > > : perfectly, but not against the remote server. I'm sure it's a
    > > security
    > > > > : or permissions problem of some sort, but I'm not sure where to
    > start.
    > > > > :
    > > > > : The code I'm using is below.
    > > > > :
    > > > > : Thanks in advance for any help.
    > > > > :
    > > > > : Cameron
    > > > > :
    > > > > :
    > > > > : HttpWebResponse Response;
    > > > > :
    > > > > : //Retrieve the File
    > > > > : HttpWebRequest Request =
    > (HttpWebRequest)HttpWebRequest.Create(url);
    > > > > : Request.Headers.Add("Translate: f");
    > > > > : Request.Credentials = CredentialCache.DefaultCredentials;
    > > > > :
    > > > > : try
    > > > > : {
    > > > > : Response = (HttpWebResponse)Request.GetResponse();
    > > > > : }
    > > > > : catch(WebException e)
    > > > > : {
    > > > > : //Handle the exception here
    > > > > : }
    > > > > : finally
    > > > > : {
    > > > > : Response.Close()
    > > > > : }
    > > > > :
    > > > > :
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    John Timney \(Microsoft MVP\) Guest

  16. #16

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    Does the app your calling expect cookies, I'm guessing that your web service
    is stateless but your web app is not. It may be trying to establish a
    session and failing.

    --
    Regards

    John Timney
    Microsoft Regional Director
    Microsoft MVP


    "warlord" <smuffnstuffhotmail.com> wrote in message
    news:Oiqg7BFGEHA.1240TK2MSFTNGP10.phx.gbl...
    > I probably should add that the same windows application calls a web
    service
    > one the server without any problems - it's only trying to get the Response
    > stream from a new Request object.
    >
    > Cheers,
    >
    > Cameron
    >
    > "John Timney (Microsoft MVP)" <timneyjdespammed.com> wrote in message
    > news:ekIhJfBGEHA.700TK2MSFTNGP09.phx.gbl...
    > > Could it be that you go through a proxy server normally, and your
    windows
    > > app is not providing the proxy credentials?
    > >
    > > --
    > > Regards
    > >
    > > John Timney
    > > Microsoft Regional Director
    > > Microsoft MVP
    > >
    > >
    > > "warlord" <smuffnstuffhotmail.com> wrote in message
    > > news:e$wySA7FEHA.1240TK2MSFTNGP10.phx.gbl...
    > > > The web server is IIS 5.0, and the Url does exist. I can get to it
    via
    > a
    > > > browser without any problems - it's just from within the windows app
    > that
    > > it
    > > > isn't accessible.
    > > >
    > > > Cheers,
    > > >
    > > > Cameron
    > > >
    > > > "Ken Schaefer" <kenREMOVETHISadOpenStatic.com> wrote in message
    > > > news:eDA1pp6FEHA.2052TK2MSFTNGP11.phx.gbl...
    > > > > Is the remote server an IIS 6.0 box? If so, is WebDAV enabled?
    > > > > Does the URL requested actually exist?
    > > > >
    > > > > Cheers
    > > > > Ken
    > > > >
    > > > > "warlord" <smuffnstuffhotmail.com> wrote in message
    > > > > news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    > > > > : I have a windows client app that is trying to download a file from
    > > > > : a web server but I always get the following error when I call the
    > > > > : GetResponse method of the Request object.
    > > > > :
    > > > > : The remote server returned an error: (404) Not Found.
    > > > > :
    > > > > : When I run it against a website on my local machine everything
    works
    > > > > : perfectly, but not against the remote server. I'm sure it's a
    > > security
    > > > > : or permissions problem of some sort, but I'm not sure where to
    > start.
    > > > > :
    > > > > : The code I'm using is below.
    > > > > :
    > > > > : Thanks in advance for any help.
    > > > > :
    > > > > : Cameron
    > > > > :
    > > > > :
    > > > > : HttpWebResponse Response;
    > > > > :
    > > > > : //Retrieve the File
    > > > > : HttpWebRequest Request =
    > (HttpWebRequest)HttpWebRequest.Create(url);
    > > > > : Request.Headers.Add("Translate: f");
    > > > > : Request.Credentials = CredentialCache.DefaultCredentials;
    > > > > :
    > > > > : try
    > > > > : {
    > > > > : Response = (HttpWebResponse)Request.GetResponse();
    > > > > : }
    > > > > : catch(WebException e)
    > > > > : {
    > > > > : //Handle the exception here
    > > > > : }
    > > > > : finally
    > > > > : {
    > > > > : Response.Close()
    > > > > : }
    > > > > :
    > > > > :
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    John Timney \(Microsoft MVP\) Guest

  17. #17

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    John,
    The web service is actually using session state (I'm not entirely sure why
    as I didn't write the service...in fact I didn't write any of it, I'm just
    the luck SOB who got the job of debugging it and finishing it off) and of
    course the web application is also using session state.

    I have even added a separate web.config file to the folder containing the
    files I'm trying to get to that explicitly sets the session state settings
    (not that I need to do that) but also overrides the authenticaton and
    authorization settings to use Windows authentication (impersonate is set to
    true) and to allow all users - all to no avail.

    Interestingly, if I disable session state for the web application the home
    page still displays as it is not reliant on session at all, but when I
    navigate to a page that uses session state the error I receive is the 404 -
    Not Found error. Your previous reply and this is what prompted me to try
    the separate config files.

    I've also set the cookieless element of the sessionState setting to true but
    that too makes no difference.

    Any further suggestions ?

    Thanks for all your help so far.

    Regards,

    Cameron Gibbs


    "John Timney (Microsoft MVP)" <timneyjdespammed.com> wrote in message
    news:eAv36yIGEHA.2208TK2MSFTNGP09.phx.gbl...
    > Does the app your calling expect cookies, I'm guessing that your web
    service
    > is stateless but your web app is not. It may be trying to establish a
    > session and failing.
    >
    > --
    > Regards
    >
    > John Timney
    > Microsoft Regional Director
    > Microsoft MVP
    >
    >
    > "warlord" <smuffnstuffhotmail.com> wrote in message
    > news:Oiqg7BFGEHA.1240TK2MSFTNGP10.phx.gbl...
    > > I probably should add that the same windows application calls a web
    > service
    > > one the server without any problems - it's only trying to get the
    Response
    > > stream from a new Request object.
    > >
    > > Cheers,
    > >
    > > Cameron
    > >
    > > "John Timney (Microsoft MVP)" <timneyjdespammed.com> wrote in message
    > > news:ekIhJfBGEHA.700TK2MSFTNGP09.phx.gbl...
    > > > Could it be that you go through a proxy server normally, and your
    > windows
    > > > app is not providing the proxy credentials?
    > > >
    > > > --
    > > > Regards
    > > >
    > > > John Timney
    > > > Microsoft Regional Director
    > > > Microsoft MVP
    > > >
    > > >
    > > > "warlord" <smuffnstuffhotmail.com> wrote in message
    > > > news:e$wySA7FEHA.1240TK2MSFTNGP10.phx.gbl...
    > > > > The web server is IIS 5.0, and the Url does exist. I can get to it
    > via
    > > a
    > > > > browser without any problems - it's just from within the windows app
    > > that
    > > > it
    > > > > isn't accessible.
    > > > >
    > > > > Cheers,
    > > > >
    > > > > Cameron
    > > > >
    > > > > "Ken Schaefer" <kenREMOVETHISadOpenStatic.com> wrote in message
    > > > > news:eDA1pp6FEHA.2052TK2MSFTNGP11.phx.gbl...
    > > > > > Is the remote server an IIS 6.0 box? If so, is WebDAV enabled?
    > > > > > Does the URL requested actually exist?
    > > > > >
    > > > > > Cheers
    > > > > > Ken
    > > > > >
    > > > > > "warlord" <smuffnstuffhotmail.com> wrote in message
    > > > > > news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    > > > > > : I have a windows client app that is trying to download a file
    from
    > > > > > : a web server but I always get the following error when I call
    the
    > > > > > : GetResponse method of the Request object.
    > > > > > :
    > > > > > : The remote server returned an error: (404) Not Found.
    > > > > > :
    > > > > > : When I run it against a website on my local machine everything
    > works
    > > > > > : perfectly, but not against the remote server. I'm sure it's a
    > > > security
    > > > > > : or permissions problem of some sort, but I'm not sure where to
    > > start.
    > > > > > :
    > > > > > : The code I'm using is below.
    > > > > > :
    > > > > > : Thanks in advance for any help.
    > > > > > :
    > > > > > : Cameron
    > > > > > :
    > > > > > :
    > > > > > : HttpWebResponse Response;
    > > > > > :
    > > > > > : //Retrieve the File
    > > > > > : HttpWebRequest Request =
    > > (HttpWebRequest)HttpWebRequest.Create(url);
    > > > > > : Request.Headers.Add("Translate: f");
    > > > > > : Request.Credentials = CredentialCache.DefaultCredentials;
    > > > > > :
    > > > > > : try
    > > > > > : {
    > > > > > : Response = (HttpWebResponse)Request.GetResponse();
    > > > > > : }
    > > > > > : catch(WebException e)
    > > > > > : {
    > > > > > : //Handle the exception here
    > > > > > : }
    > > > > > : finally
    > > > > > : {
    > > > > > : Response.Close()
    > > > > > : }
    > > > > > :
    > > > > > :
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    warlord Guest

  18. #18

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    John,
    The web service is actually using session state (I'm not entirely sure why
    as I didn't write the service...in fact I didn't write any of it, I'm just
    the luck SOB who got the job of debugging it and finishing it off) and of
    course the web application is also using session state.

    I have even added a separate web.config file to the folder containing the
    files I'm trying to get to that explicitly sets the session state settings
    (not that I need to do that) but also overrides the authenticaton and
    authorization settings to use Windows authentication (impersonate is set to
    true) and to allow all users - all to no avail.

    Interestingly, if I disable session state for the web application the home
    page still displays as it is not reliant on session at all, but when I
    navigate to a page that uses session state the error I receive is the 404 -
    Not Found error. Your previous reply and this is what prompted me to try
    the separate config files.

    I've also set the cookieless element of the sessionState setting to true but
    that too makes no difference.

    Any further suggestions ?

    Thanks for all your help so far.

    Regards,

    Cameron Gibbs


    "John Timney (Microsoft MVP)" <timneyjdespammed.com> wrote in message
    news:eAv36yIGEHA.2208TK2MSFTNGP09.phx.gbl...
    > Does the app your calling expect cookies, I'm guessing that your web
    service
    > is stateless but your web app is not. It may be trying to establish a
    > session and failing.
    >
    > --
    > Regards
    >
    > John Timney
    > Microsoft Regional Director
    > Microsoft MVP
    >
    >
    > "warlord" <smuffnstuffhotmail.com> wrote in message
    > news:Oiqg7BFGEHA.1240TK2MSFTNGP10.phx.gbl...
    > > I probably should add that the same windows application calls a web
    > service
    > > one the server without any problems - it's only trying to get the
    Response
    > > stream from a new Request object.
    > >
    > > Cheers,
    > >
    > > Cameron
    > >
    > > "John Timney (Microsoft MVP)" <timneyjdespammed.com> wrote in message
    > > news:ekIhJfBGEHA.700TK2MSFTNGP09.phx.gbl...
    > > > Could it be that you go through a proxy server normally, and your
    > windows
    > > > app is not providing the proxy credentials?
    > > >
    > > > --
    > > > Regards
    > > >
    > > > John Timney
    > > > Microsoft Regional Director
    > > > Microsoft MVP
    > > >
    > > >
    > > > "warlord" <smuffnstuffhotmail.com> wrote in message
    > > > news:e$wySA7FEHA.1240TK2MSFTNGP10.phx.gbl...
    > > > > The web server is IIS 5.0, and the Url does exist. I can get to it
    > via
    > > a
    > > > > browser without any problems - it's just from within the windows app
    > > that
    > > > it
    > > > > isn't accessible.
    > > > >
    > > > > Cheers,
    > > > >
    > > > > Cameron
    > > > >
    > > > > "Ken Schaefer" <kenREMOVETHISadOpenStatic.com> wrote in message
    > > > > news:eDA1pp6FEHA.2052TK2MSFTNGP11.phx.gbl...
    > > > > > Is the remote server an IIS 6.0 box? If so, is WebDAV enabled?
    > > > > > Does the URL requested actually exist?
    > > > > >
    > > > > > Cheers
    > > > > > Ken
    > > > > >
    > > > > > "warlord" <smuffnstuffhotmail.com> wrote in message
    > > > > > news:uURCxk6FEHA.2428tk2msftngp13.phx.gbl...
    > > > > > : I have a windows client app that is trying to download a file
    from
    > > > > > : a web server but I always get the following error when I call
    the
    > > > > > : GetResponse method of the Request object.
    > > > > > :
    > > > > > : The remote server returned an error: (404) Not Found.
    > > > > > :
    > > > > > : When I run it against a website on my local machine everything
    > works
    > > > > > : perfectly, but not against the remote server. I'm sure it's a
    > > > security
    > > > > > : or permissions problem of some sort, but I'm not sure where to
    > > start.
    > > > > > :
    > > > > > : The code I'm using is below.
    > > > > > :
    > > > > > : Thanks in advance for any help.
    > > > > > :
    > > > > > : Cameron
    > > > > > :
    > > > > > :
    > > > > > : HttpWebResponse Response;
    > > > > > :
    > > > > > : //Retrieve the File
    > > > > > : HttpWebRequest Request =
    > > (HttpWebRequest)HttpWebRequest.Create(url);
    > > > > > : Request.Headers.Add("Translate: f");
    > > > > > : Request.Credentials = CredentialCache.DefaultCredentials;
    > > > > > :
    > > > > > : try
    > > > > > : {
    > > > > > : Response = (HttpWebResponse)Request.GetResponse();
    > > > > > : }
    > > > > > : catch(WebException e)
    > > > > > : {
    > > > > > : //Handle the exception here
    > > > > > : }
    > > > > > : finally
    > > > > > : {
    > > > > > : Response.Close()
    > > > > > : }
    > > > > > :
    > > > > > :
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    warlord Guest

  19. #19

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    > The web service is actually using session state (I'm not entirely sure why
    > as I didn't write the service...in fact I didn't write any of it, I'm just
    > the luck SOB who got the job of debugging it and finishing it off) and of
    > course the web application is also using session state.

    if thats the case, then your winforms app needs to handle the cookie asp.net
    generates when you connect to the server. The server will expect the
    session cookie to be passed back to it.


    --
    Regards

    John Timney
    Microsoft Regional Director
    Microsoft MVP




    John Timney \(Microsoft MVP\) Guest

  20. #20

    Default Re: HttpWebRequest.GetResponse returns 404 No Found error

    > The web service is actually using session state (I'm not entirely sure why
    > as I didn't write the service...in fact I didn't write any of it, I'm just
    > the luck SOB who got the job of debugging it and finishing it off) and of
    > course the web application is also using session state.

    if thats the case, then your winforms app needs to handle the cookie asp.net
    generates when you connect to the server. The server will expect the
    session cookie to be passed back to it.


    --
    Regards

    John Timney
    Microsoft Regional Director
    Microsoft MVP




    John Timney \(Microsoft MVP\) Guest

Page 1 of 2 12 LastLast

Similar Threads

  1. #26039 [Opn->Bgs]: php -b 8080 returns option not found b
    By sniper@php.net in forum PHP Development
    Replies: 0
    Last Post: October 30th, 06:59 PM
  2. #26039 [NEW]: php -b 8080 returns option not found b
    By ken dot davis at experioronline dot com in forum PHP Development
    Replies: 0
    Last Post: October 30th, 01:57 PM
  3. Replies: 0
    Last Post: October 15th, 12:35 AM
  4. HttpWebRequest causes 500 error for ASP page.
    By Berto in forum ASP.NET Web Services
    Replies: 0
    Last Post: October 3rd, 11:02 AM
  5. GetResponse() Error in .NET 2003
    By Dayakar in forum ASP.NET General
    Replies: 0
    Last Post: July 9th, 10:08 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139