Determine Filename

J

Jonathan Wood

Greetings,

I'm using WebRequest and WebResponse to download files from the Web. One
thing I need to do is detect redirection and get the real name of the file
that is actually downloaded.

I see that HttpWebResponse has a StatusCode property that indicates if the
request was redirected or other status codes. However, I need my code to
support FTP as well so I'm thinking I can't use HttpWebResponse, but
WebResponse has no such property.

Does anyone have any idea how I'd detect the actual name of the file
downloaded with WebRequest and WebResponse? I looked at WebResponse.Headers
but didn't see any information like this.

Thanks.

Jonathan
 
J

Jonathan Wood

Looks like the ResponseUri property has what I need.

If anyone knows any issues with what I'm doing and FTP downloads, I'd like
to hear about it.

Otherwise, I appear to have it working.

Jonathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top