?
Solved

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

Posted on 2012-08-16
1
Medium Priority
?
447 Views
Last Modified: 2012-08-16
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.
0
Comment
Question by:dcrowley_01
1 Comment
 
LVL 23

Accepted Solution

by:
Michael Fowler earned 2000 total points
ID: 38303241
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
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question