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

How to check to see if a file exist.

P: n/a
How can i check to see if a link (file) exist while a web page is loading.
If the page doesn't exist - i want the hyperlink to go an error page telling
the user the link doesn't exist otherwise they will just go the link which
is a pdf file.

I'm using asp.net 2003.

thanks

Dave
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
have a look at the customerror attributes in the webconfig file

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Dave" <Da**********@hotmail.com> wrote in message
news:uR**************@tk2msftngp13.phx.gbl...
How can i check to see if a link (file) exist while a web page is loading.
If the page doesn't exist - i want the hyperlink to go an error page
telling
the user the link doesn't exist otherwise they will just go the link which
is a pdf file.

I'm using asp.net 2003.

thanks

Dave

Nov 18 '05 #2

P: n/a
Hi Dave:

Is this a local file on the server? If so, you could use File.Exists
to check (from the System.IO namespace). Don't forget to use
Server.MapPath to get a physical path to the file.

HTH,

--
Scott
http://www.OdeToCode.com

On Tue, 18 May 2004 08:28:26 -0700, "Dave" <Da**********@hotmail.com>
wrote:
How can i check to see if a link (file) exist while a web page is loading.
If the page doesn't exist - i want the hyperlink to go an error page telling
the user the link doesn't exist otherwise they will just go the link which
is a pdf file.

I'm using asp.net 2003.

thanks

Dave


Nov 18 '05 #3

P: n/a
Got it and it works

thanks for help
"Dave" <Da**********@hotmail.com> wrote in message
news:uR**************@tk2msftngp13.phx.gbl...
How can i check to see if a link (file) exist while a web page is loading.
If the page doesn't exist - i want the hyperlink to go an error page telling the user the link doesn't exist otherwise they will just go the link which
is a pdf file.

I'm using asp.net 2003.

thanks

Dave

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.