473,698 Members | 2,153 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determine if File Exists

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(Ser ver.MapPath("./scores/" & strCurrEventID & ".pdf")) Then

btnViewScores.E nabled = True

End If
Nov 21 '05 #1
2 1719
Wayne,

"Wayne Wengert" <wa***********@ wengert.org> schrieb:
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(Ser ver.MapPath("./scores/" & strCurrEventID & ".pdf")) Then


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

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
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 [MVP]" <hi************ ***@gmx.at> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Wayne,

"Wayne Wengert" <wa***********@ wengert.org> schrieb:
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(Ser ver.MapPath("./scores/" & strCurrEventID & ".pdf"))
Then


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

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1940
by: Kamus of Kadizhar | last post by:
Thanks to everyone on this list. I now have a functioning piece of python code!! :-)) Now I'm trying to clean it up. I have the same (or similar) lines repeated several times: shutil.copy2(newArrivalsDir+'/'+movie,archivesDir) thumb = string.replace(movie,'.avi','.jpg') shutil.copy2(newArrivalsDir+'/tn/'+thumb,archivesDir+'/tn/')
2
4339
by: OvErboRed | last post by:
Hi, I'm trying to determine whether a given URL exists. I'm new to Python but I think that urllib is the tool for the job. However, if I give it a non-existent file, it simply returns the 404 page. Aside from grepping this for '404', is there a better way to do this? (Preferrably, there is a solution that can be applied to both HTTP and FTP.) Thanks in advance.
6
2003
by: Opie | last post by:
What would be a more efficient way for me to determine if a record in an SQL DB table exists? Right now, I have a try/catch like this: try { if(checkcom.ExecuteScalar().ToString()==tbBillNumber.Text) { .... } }
8
1588
by: Darrell Wesley | last post by:
Is there any better method of determining if a file exists then using the Scripting.FileSystemObject If I do thi Dim fs As New System.IO.StreamReader(FileName and the file does not exist thena n exception is thrown, how can you determine if the file exists before attemptng to open it
7
3725
by: Stephen E. Weber | last post by:
I need to determine if a file exists using code. I tried using the system.io.file.exists function, that will appears to locate the file if I use the complete filespec, when I move the project to the web server, that command will not work because I can not specify the entire path, just the path relative to the default project folder. Example This is the path my image property uses: "~/image/NoImageAvailable.jpg"
28
20614
by: Tim Daneliuk | last post by:
I have a program wherein I want one behavior when a file is set as executable and a different behavior if it is not. Is there a simple way to determine whether a given named file is executable that does not resort to all the lowlevel ugliness of os.stat() AND that is portable across Win32 and *nix? Thanks, ---------------------------------------------------------------------------- Tim Daneliuk tundra@tundraware.com PGP Key: ...
1
2559
by: topramen | last post by:
does any one here know of a good way to to determine whether or not a given path is a directory (e.g., "c:\mydir") or a file (e.g., "c:\mydir \myfile.txt")? i started attacking this problem by using filesystemobject to check whether or not a directory existed for the path. if so, it was a directory path. if not, i checked to see if a file existed for it. if so, it was a file path. this code is shown below: ...
7
7618
by: Cramer | last post by:
I'm wondering if there is an easy way to programmatically determine if an assembly is installed in the GAC. This would be similar to our ability to easily determine if a file exists (File.Exists(path)) - but for an assembly, of a particular version, etc in the GAC. I have googled this and failed to find anything useful. Thanks
3
2543
by: LordHog | last post by:
Hello, How would I go about finding the default handler, let's say a text file (*.txt), then launch the default handler with the file as an argument? I had found how to launch an external program, but I do not know how I would find the default handler to a file type. Any help is greatly appreciated. Code to launch application: ProcessStartInfo pInfo = new ProcessStartInfo();
0
8672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9018
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8890
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8858
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5859
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2322
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.