473,320 Members | 1,724 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,320 software developers and data experts.

.Net 2.0 C# FileStream question

Hi,

In my C# web application I have a code as:
FileStream fs = new FileStream(@"c:\temp\AAA.txt" , FileMode.OpenOrCreate,
FileAccess.ReadWrite);
When I execute the application, it gave me an error saying refusing access
to that file.
I have the AAA.txt on client's PC's c:\temp\AAA.txt, and it's not readonly.
What could I have done wrong?
Thanks for help.
Jason
Feb 12 '08 #1
1 1223
Is the file still open elsewhere? If code has generated this file
moments before, this is entirely possible (since you aren't visibly
using "using" etc for the read, I'm guessing you might not have done
so for the write).

One way to tell by what: obtain "Process Explorer" (free download from
technet) and search for the file handle.

Also: does the specific account in question have access?

Marc
Feb 12 '08 #2

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

Similar topics

2
by: Kai Bohli | last post by:
Hi all ! This is my first day with Visual Studio and C#, and I'm trying to send "raw data" to the printer port. I found the SendFileToPrinter example below in a knowledge base at MS site It...
9
by: Tom | last post by:
I am working with the this object as oppose to the StreamReader object becuase I need to access a file (to find the contents) while an external application is updating the file. When I was...
0
by: Tim Kohler | last post by:
I'm trying to open a file for writing in a server process. I do not want any other process to be able to write to the file while I have it open, but I do want to allow other programs to read from...
5
by: Chris Fink | last post by:
How do I load a string into a FileStream without going to disk? For example, string abc = "This is a string"; How do I load abc into a FileStream? FileStream input = new FileStream(.....);
0
by: lh | last post by:
The following method only works when i give the ASP.net account full permissions on the directory. It doesn't work when i give the directory Modify, Read &Execute, List Folder Contents, Read, and...
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,...
2
by: ewingate | last post by:
The following code which is supposed to dynamically create files with incrementing names is throwing an exception due to the inclusion of the DateTime.Now component of the sReportSave string: ...
0
by: dave | last post by:
my other Question: im Parsing data from a File.... should i be using string objects or stringbuilder i was reading about both of them and im looping through files upwards of 20meg to 100 meg of...
2
by: =?Utf-8?B?TWlzY2hh?= | last post by:
It is my understanding that I can create an XmlTextReader from a variety of sources, including a stream object. I am developing a web application that reads some data from an Xml file. Everything...
7
by: Piotrekk | last post by:
Hi Probability of this phenomena is like 1/200. The only code where I am dealing with file is the following: using (FileStream fs = new FileStream(this.FilePath,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.