473,804 Members | 3,425 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 2027
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
1129
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
4030
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
2322
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
7150
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
1703
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
9704
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
9571
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
10561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10318
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...
0
9132
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
7608
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
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2976
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.