473,651 Members | 2,536 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with File.Exists in IIS


try if(File.Exists( Server.MapPath( "filename.xml") ))


-----Original Message-----
HI

I have an aspx page that imports the System.IO namespace. Then in thePage_Load event I have an if(File.Exists( "filename.xml") ) {} it keepson returning false for some reason even when the file exists in thesame directory. It works fine with the ASP.NET WebMatrix webserver butit returns false with IIS.

Anyone have any ideas on what is happening?
Thanks
abz
.

Nov 17 '05 #1
1 2161
Hi I tried that and it didnt work, however i'v worked my way around
that and using exception handling for the same effect. I wanted to do
some processing if the file existed but now I do the processing anyway
and if the file doesn't exist then its trapped in try and catch block.
Thanks
Abz

"szabelin" <szabelin@szabe lin> wrote in message news:<0d******* *************** ******@phx.gbl> ...
try if(File.Exists( Server.MapPath( "filename.xml") ))


-----Original Message-----
HI

I have an aspx page that imports the System.IO namespace.

Then in the
Page_Load event I have an if(File.Exists( "filename.xml") )

{} it keeps
on returning false for some reason even when the file

exists in the
same directory. It works fine with the ASP.NET WebMatrix

webserver but
it returns false with IIS.

Anyone have any ideas on what is happening?
Thanks
abz
.

Nov 17 '05 #2

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

Similar topics

5
2719
by: Juho Saarikko | last post by:
I made a Python script which takes Usenet message bodies from a database, decodes uuencoded contents and inserts them as Large Object into a PostGreSQL database. However, it appears that the to last few bytes of uudecoded data are always mangled. Take a look of this hexdump output: Originals (decoded with Pan, each line is from a different file): 000c2c0 e1bf 00ff 2541 a9e4 a724 d9ff 0011a10 ff54 00d9 00093e0 fb4f a80d ffd9 c200 ffef...
1
2087
by: | last post by:
Hello, I tried to build Python 2.4.1 on a Reliant Unix system. Just after the python executable program has been built, I get the following error: ==== begin make output === CC -W1 -Blargedynsym -o python \ Modules/python.o \ libpython2.4.a -lresolv -lsocket -lnsl -ldl -lm
0
1460
by: Tim Richardson | last post by:
I am attempting to copy some files from one machine to another. I am having difficulty with the File.Exists() in the code below. The program enumerates the files in a directory, checks them against a cuttoff DateTime, and copies them if thet do not already exist. All progress is written to a log (a snippet is included below the code). The File.Exists() method returns false even when the file does in fact exist. Have I coded this...
5
1113
by: matt dittman | last post by:
I have created a windows service that reads emails from a drop directory and moves them to the appropriate mail folder every 15 seconds. I can move, rename and delete the files as needed, up until the CDO.DropDirectory.GetMessages() method is called. At this point, the files are locked until I shut down the service. After processing and delivery, I need to be able to delete all the files in the drop directory. I can delete them via...
3
3667
by: David Baumgarten | last post by:
I am trying to download a file from a ftp server and if the file already exists to overwrite it. Here is my code: FtpGetFile(hConnection, "1.pdf", FLocation & "\Temp\" & "1.pdf", False, 1, 0, 0) If file does not exists then this returns true and downloads file. If file already exists then this returns false and doesnt download file.
3
15625
by: Jagdip Singh | last post by:
Hi, We are facing problem accessing to DB2. Seems like database manager is down I tried starting it using db2start but it was neither showing any messages nor returning to command prompt after finishing start. I do not know actually if it was trying to start database or hanging somewhere
12
2286
by: Riley DeWiley | last post by:
I have a project that is using a Jet backend and having trouble with Jet's tendency to bloat it's MDB file. I can compact it but it is a hassle. I am considering switching to a Fox backend but have not used one. I want to know: 1) Does the Foxpro backend also bloat like this? 2) Is it hard to distribute fox binaries if all you want is bare bones DBMS stuff (I handle all the UI)? RDeW
3
6261
by: moondaddy | last post by:
I need to start an ms access 2003 app from a vb.net winforms app and didn't want to load all the interop stuff for office into the .net project. I thought that using the shell cmd would be a nice clean way to get it started. However, when I call the shell cmd, I get a "File Not Found" error. here's my code: Dim ClientPath As String = Directory.GetCurrentDirectory & "\" &...
6
2340
by: TPJ | last post by:
Help me please, because I really don't get it. I think it's some stupid mistake I make, but I just can't find it. I have been thinking about it for three days so far and I still haven't found any solution. My code can be downloaded from here: http://www.tprimke.net/konto/PyObject-problem.tar.bz2. There are some scripts for GNU/Linux system (bash to be precise). All you need to know is that there are four classes. (Of course, you may...
2
1668
by: ELINTPimp | last post by:
Hello all, Have a really interesting problem (at least to me) with my upload_file() function. I have it working now, with a bit of a work around, but would like to know what everyone thinks in regards to this being a bug or perhaps my ignorance. Basically the function takes two arguments, one is the desired file path I want the upload file to be moved to, and the second is an arbitrary integer. If the file doesn't already exist, the...
0
8694
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
8457
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
8571
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...
0
7294
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
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
5605
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();...
0
4143
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4280
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1905
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.