473,396 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem with FileStream - FileNotFoundException

Hi,
I have the following problem with FileStream. In this line:

FileStream file = new FileStream(filePath, FileMode.Append);

there is an exception FileNotFoundException. But for sure path and file name
(which are both concatenated to filePath) is correct and leads to the
existing directory. User on which application is running has full permision
to the destination folder. On MSDN stands that FileMode.Append ensures that
if file exists it will be opened otherwise new file will be created.
I've cheked other constructors of the FileStream class and the same
exception is thrown. The most surprising thing is that bug does not occur in
all cases. It is possible to change destination folder and everything is ok.
Can the problem be caused by number of files in destination folder (there is
more than tousand files)?
Do you have any suggestion what should I do? Or do you know why such
exception can occur?

My environment:
I'm using ASP.NET 2.0 on IIS 6.0 (Windows 2003). Destination folder is on
the other computer in the same domain (Active Directory is in use).
Nov 29 '07 #1
2 2009
Radek wrote:
Hi,
I have the following problem with FileStream. In this line:

FileStream file = new FileStream(filePath, FileMode.Append);

there is an exception FileNotFoundException. But for sure path and file name
(which are both concatenated to filePath) is correct and leads to the
existing directory. User on which application is running has full permision
to the destination folder. On MSDN stands that FileMode.Append ensures that
if file exists it will be opened otherwise new file will be created.
I've cheked other constructors of the FileStream class and the same
exception is thrown. The most surprising thing is that bug does not occur in
all cases. It is possible to change destination folder and everything is ok.
Can the problem be caused by number of files in destination folder (there is
more than tousand files)?
Do you have any suggestion what should I do? Or do you know why such
exception can occur?

My environment:
I'm using ASP.NET 2.0 on IIS 6.0 (Windows 2003). Destination folder is on
the other computer in the same domain (Active Directory is in use).

Are content of variable "filePath" like "\\jack\folder\fileapp.txt" ?
--
Duy Lam Phuong
Nov 29 '07 #2
Are content of variable "filePath" like "\\jack\folder\fileapp.txt" ?

yes, something like this
Nov 29 '07 #3

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

Similar topics

2
by: Nikolay Petrov | last post by:
I get an System.IO.FileNotFoundException when trying to serialize data. The "not found file" is a random name .dll after doing some Google, if found this article:...
2
by: Mike | last post by:
Hello. I am using C# in .NET v1.1. I am trying to serialize an object to disk and read it back again. The serialization seems to work OK (at least, it completes without error). However, I get...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
7
by: Nathan Sokalski | last post by:
I am having a problem saving an image with the same name it originally had. I have two similar versions of my code, one in which I close the FileStream used to open the original image before saving,...
1
by: kkizer | last post by:
I have a problem with this simple code below. Moving the files works perfectly, but once in a blue moon the file that it is trying to move dissapears before it can move it. and when this happens...
4
by: PiotrKolodziej | last post by:
hi I have a thread that downloades a file. Problem is : Not all files are beeing downloaded. I observed that only the small files are beeing downloaded correctly. I also cant download two files...
0
by: vishalsharma | last post by:
hi i am having problem when i am trying to write something on remote location using .net thread. e.g. i have a central location letsay MachineName|MachineIP/SharedDrive. and i am creating a...
0
by: wisaunders | last post by:
the file I'm importing has > 200,000 records I have one problem: One of the columns in the .txt file (customerID) has almost all Inetger values except for about 30 records. Those 30 records...
1
by: prasath03 | last post by:
Hi, I am struggling with the following problem. Can somebody pls help me?. I am developing a wesbite for user can edit their files only, so i am going to develop a page for a Tree Structure in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
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...

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.