Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

File IO - Access to path "xxx" is denied Error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul - 04 Dec 2007 13:42 GMT
I am getting an "Access to the path "xxxx" is denied error.

I believe is because the file that I am writing to programatically is being
read/written to by another end user. These files have the same file name and
must have the same file name. I am essentially overwrite an existing file
that is being used by another user.

My question: Is there some method or property in the IO class that will
allow me to CHECK to see if it is safe to try and write to that file name?

TIA.
Eliyahu Goldin - 04 Dec 2007 13:58 GMT
More likely the problem is in the asp.net process not having enough rights
to access the path.

If the problem is in another user trying to access the file, you can just
try opening the file in a loop for a few seconds with catching exceptions.
But it is not a good idea to make a web application wait for this sort of
things. What is the file for anyway?

Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

>I am getting an "Access to the path "xxxx" is denied error.
>
[quoted text clipped - 9 lines]
>
> TIA.
Paul - 04 Dec 2007 21:59 GMT
Thanks for your assistance.

No this is the process.

- I grab data and write it to a file.
- That file is then included in an intranet page. A user opens (i.e. reads)
that page and leaves it open in their browser. This "locks" the file (I
think).
- I then grab data again programatically (scheduled task) and I try to
programmatically overwrite the file that is already open by the intranet
user. An error occurs.

I am trying to eliminate the error but first programmatically checking to
determine if the file is "open" or it is not open and I can safely write to
it.

I do not see anywhere for that check. I know I can trap the error but I
would rather not do that.

> More likely the problem is in the asp.net process not having enough rights
> to access the path.
[quoted text clipped - 17 lines]
> >
> > TIA.
Eliyahu Goldin - 05 Dec 2007 08:41 GMT
> - That file is then included in an intranet page. A user opens (i.e.
> reads)
> that page and leaves it open in their browser. This "locks" the file (I
> think).
Once the file has been streamed down to the client's browser, there is no
more connection between the file and the client. The file can't be locked
because of this. I still think you are more likely having permission
problems.

Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

> Thanks for your assistance.
>
[quoted text clipped - 43 lines]
>> >
>> > TIA.
Alexey Smirnov - 05 Dec 2007 10:09 GMT
> Thanks for your assistance.
>
[quoted text clipped - 45 lines]
>
> - Show quoted text -

Try to create a file and overwrite it without letting user open it. If
it doesn't work - it's a permissions issue.
coolCoder - 04 Dec 2007 14:40 GMT
> I am getting an "Access to the path "xxxx" is denied error.
>
[quoted text clipped - 7 lines]
>
> TIA.

A common type of error in these kind of programs is that we keep the
file handle open and when we try to access file next time, it gives
you access denied error.
Please check whether you have closed the file handle properly.
Also check whether you can find that file in Task Manager processes
tab ??
These all are guesses and may not apply.
Paul - 04 Dec 2007 22:01 GMT
I close the IO StreamWriter right after I am done with the Write. See my
response above to Eliyahu for a more detailed explanation of what I am doing.

Thanks for your assistance.

> > I am getting an "Access to the path "xxxx" is denied error.
> >
[quoted text clipped - 15 lines]
> tab ??
> These all are guesses and may not apply.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.