Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   How to check to see if a file exist. (http://www.velocityreviews.com/forums/t78457-how-to-check-to-see-if-a-file-exist.html)

Dave 05-18-2004 03:28 PM

How to check to see if a file exist.
 
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



Alvin Bruney [MVP] 05-18-2004 03:43 PM

Re: How to check to see if a file exist.
 
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" <DaveTichenor@hotmail.com> wrote in message
news:uR3eFzOPEHA.3016@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
>
>




Scott Allen 05-18-2004 03:57 PM

Re: How to check to see if a file exist.
 
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" <DaveTichenor@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
>



Dave 05-18-2004 05:12 PM

Re: How to check to see if a file exist.
 
Got it and it works

thanks for help


"Dave" <DaveTichenor@hotmail.com> wrote in message
news:uR3eFzOPEHA.3016@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
>
>





All times are GMT. The time now is 11:34 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.