Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking if a file exists on a secure web server

Status
Not open for further replies.

jshurst

Programmer
Oct 27, 2004
1,158
US
I need to download some files on a secure web server. I'm using the VisualBasic.Devices.Network.DownloadFile() method, however if the file does not exist then it throws an exception.

Does anyone have any ideas on how to check for this existence of the file? It is not on my local network and I have to use a username and password to log into the server over http.

Thanks,

J
 
Yes, I had a hunch that may happen. Like the httpWebRequest, if a valid 404 status is returned, .NET treats it as an exception. Whilst it isn't normally recommended, you may have to use an exception for the execution flow (i.e. put it in it's own function and return True/False depending on whether the error occurs).


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
That's what I was just talking about with a colleague ;-)

Thanks,

J
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top