Determine if File Exists

  • Thread starter Thread starter Wayne Wengert
  • Start date Start date
W

Wayne Wengert

I am trying to determine if a file exists on a web site but I cannot get a
match. I have verified that the file does exists in the specified directory
(I verified the case of the file and directory name). The code (below) is
from one of my aspx pages. Is there something here I overlooked?

Wayne

======================= code =======================
If File.Exists(Server.MapPath("./scores/" & strCurrEventID & ".pdf")) Then

btnViewScores.Enabled = True

End If
 
Wayne,

Wayne Wengert said:
I am trying to determine if a file exists on a web site but I cannot get a
match. I have verified that the file does exists in the specified directory
(I verified the case of the file and directory name). The code (below) is
from one of my aspx pages.
[...]
======================= code =======================
If File.Exists(Server.MapPath("./scores/" & strCurrEventID & ".pdf")) Then

Did you already check the string returned by 'Server.MapPath'?
 
Herfried;

Thanks for the response. I did check that value. I just found that there was
some strange character after the "jpg" on the server. I deleted the file,
uploaded it again and now it works.

Wayne

Herfried K. Wagner said:
Wayne,

Wayne Wengert said:
I am trying to determine if a file exists on a web site but I cannot get a
match. I have verified that the file does exists in the specified
directory (I verified the case of the file and directory name). The code
(below) is from one of my aspx pages.
[...]
======================= code =======================
If File.Exists(Server.MapPath("./scores/" & strCurrEventID & ".pdf"))
Then

Did you already check the string returned by 'Server.MapPath'?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top