We help IT Professionals succeed at work.

Is there a way to dynamically create a link only if a file exists in ASP.net / C#?

dcrowley_01
dcrowley_01 asked
on
I am moving a load of PDF files to our webserver. I am looking for a way to dynamically create a link only if the file exists. Some ID's will have certain files, while others will not.
So I want it to check for the existence of 5155032.PDF before creating the link, otherwise don't create it.
Comment
Watch Question

Solutions Consultant
CERTIFIED EXPERT
Commented:
Use the File.Exists method to determine if the file is available and create the link at runtime if true

http://msdn.microsoft.com/en-us/library/system.io.file.exists.aspx

Michael

Explore More ContentExplore courses, solutions, and other research materials related to this topic.