By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,120 Members | 1,786 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,120 IT Pros & Developers. It's quick & easy.

HttpWebRequest.GetResponse returns 404 No Found error

P: n/a
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()
}
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


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

Cheers
Ken

"warlord" <sm*********@hotmail.com> wrote in message
news:uU**************@tk2msftngp13.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()
: }
:
:
Nov 18 '05 #2

P: n/a
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" <ke*******@THISadOpenStatic.com> wrote in message
news:eD**************@TK2MSFTNGP11.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" <sm*********@hotmail.com> wrote in message
news:uU**************@tk2msftngp13.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()
: }
:
:

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.