473,835 Members | 2,203 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with FileStream - FileNotFoundExc eption

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

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

there is an exception FileNotFoundExc eption. 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 2029
Radek wrote:
Hi,
I have the following problem with FileStream. In this line:

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

there is an exception FileNotFoundExc eption. 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
1130
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: http://weblogs.asp.net/cschittko/articles/33045.aspx I am not expirenced enough to do the testing, which is described there. But according to it, maybe my XmlSerializer can't serialize my data.
2
1808
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 the following error when trying to deserialize: An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll
10
4032
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 application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
7
2325
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, the other in which I close the FileStream afterwards, although both return the same error. Here are the two versions of the code and the errors they each return (NOTE: I rebooted immediately before running each of these versions so that I knew they...
1
7151
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 the "System.IO.Move" goes in to a loop and keeps creating the file on the destination folder with a 0byte size and keeps entering the error in the log i have until someone stop the service. so what i cant figure out is since it catches the...
4
2019
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 in a row. I got to Exit and run the program again to even start downloading. The second problem i interprett as iam not closing something ( but don't know what ). For the first problem i have no idea what is wrong.Here is the download thread Maybe...
0
785
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 thread on click of a button which i need to write some information on that location. i have also added a node <identity impersonate="true" userName="Domain\User" password="*******"/> in web.config of my application. and i have also given...
0
1704
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 have one letter in the customerID field (M123456). The field they are going into is VARCHAR(1000) . All of the integers go in correctly but for some reason the cutomerID values that stert with a letter (M123456) are NULL. Any help? I'm stumped. ...
1
2087
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 jsp. I got one java code from internet, that working perfectly in java, it doesn't work after i converted in jsp. I don't know what is the problem in that code. If anybody knows the answer let me know.... When i run that code from jsp it throws the...
0
9653
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,...
1
10563
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
10237
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
9348
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
7770
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
6970
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
5640
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...
2
3999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3094
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.