I have an ASP web site written using VB.Net. I have a virtual directory with pdf files in it. I have a web page with links that perform a response.redirect to the pdf file so that the browser loads and displays the pdf file I am redirecting to.
Not all the pdf files may exist so what I need to a method of checking if the url I am redirecting to (pdf file) exists before attempting to response.redirect to it. I have tried using system.io.fileexists with and wthout using server.mappath and it always fails as if the file does not exist even when it does. So this method does not work.
How can I make sure the pdf file exists before issuing a response.redirect to it?