473,432 Members | 2,025 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,432 software developers and data experts.

Odd "Access to the path is denied" exception being thrown

Hi there,

I got a web application in vb.net that uploads a .zip file to a subfolder
inside the root folder of the web application.

c:\Inetpub\wwwroot\MyWebApp\uploaddir

Then, a c# library unzips it inside another subfolder inside the subfolder
where the .zip was uploaded.

c:\Inetpub\wwwroot\MyWebApp\uploaddir\unzip

Then the same c# library moves all unzipped files to a whole new location,
outside the web application, but it is by the way configured in IIS as
another virtual directory.

c:\Permanent Repository

The code in c# that makes the move is shown below:

DirectoryInfo[] unzippedfilesdir = uploaddir.GetDirectories();
FileInfo[] unzippedfiles = unzippedfilesdir[0].GetFiles();
foreach (FileInfo afile in unzippedfiles)
afile.MoveTo(m_permanentrepository + "\\" + afile.Name);

In a test I am doing, there is a zip file with +200 files in it. The
routine that moves the unzipped files works just fine until it reaches the
108th file. It throws a "Access to the path is denied" exception when it
tries the MoveTo method on that file.

<machinename>\ASPNET user has all permissions granted on both dirs (source
and destination). I have not opened nor used any of the unzipped files prior
to begin to move them. It is solely a process of uploading, unzipping, and
moving, and that's it.

What is going on then???

The file that the routine tries to move and fails is a ASP file
("info.asp"). Does that got anything to do with the problem? If it does,
then how come this was working 2 months ago, and now it is not? Is it
perhaps some sort of configuration that had been changed without me knowing
it?

I will highly appreciate if someone sheds a light on this case promptly.

Many thanks!

--
Carlitos
Nov 17 '05 #1
4 22464
Carlitos wrote:
In a test I am doing, there is a zip file with +200 files in it. The
routine that moves the unzipped files works just fine until it reaches the
108th file. It throws a "Access to the path is denied" exception when it
tries the MoveTo method on that file.

[ . . . ]

The file that the routine tries to move and fails is a ASP file
("info.asp"). Does that got anything to do with the problem? If it does,
then how come this was working 2 months ago, and now it is not? Is it
perhaps some sort of configuration that had been changed without me knowing
it?


From a cursory inspection, your routine looks fine. From the name of the
ASP file, my guess is that the file is in use by another process. Try and
use Sysinternal's Filemon to get a better impression of who's messing with
these files just prior to the error:

http://www.sysinternals.com/Utilities/Filemon.html

Please write back if you're still having trouble tracking this down. Good luck.
--
Derrick Coetzee, MCP, MSFT (Speech Server)
This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included code samples are subject to the terms
specified at http://www.microsoft.com/info/cpyright.htm
Nov 17 '05 #2
Hello Derrick,

Thanks for the response. Yesterday I made a test. Instead of uploading the
zip and unzipping it into a subfolder of the Web Application, I made the same
process into a folder outside the Web Application folder (c:\upload), but got
the same error "Access...denied". I'm gonna try to look using the tool you
suggested and let you know what's the outcome.

Many thanks.

--
Carlitos
"Derrick Coetzee [MSFT]" wrote:
Carlitos wrote:
In a test I am doing, there is a zip file with +200 files in it. The
routine that moves the unzipped files works just fine until it reaches the
108th file. It throws a "Access to the path is denied" exception when it
tries the MoveTo method on that file.

[ . . . ]

The file that the routine tries to move and fails is a ASP file
("info.asp"). Does that got anything to do with the problem? If it does,
then how come this was working 2 months ago, and now it is not? Is it
perhaps some sort of configuration that had been changed without me knowing
it?


From a cursory inspection, your routine looks fine. From the name of the
ASP file, my guess is that the file is in use by another process. Try and
use Sysinternal's Filemon to get a better impression of who's messing with
these files just prior to the error:

http://www.sysinternals.com/Utilities/Filemon.html

Please write back if you're still having trouble tracking this down. Good luck.
--
Derrick Coetzee, MCP, MSFT (Speech Server)
This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included code samples are subject to the terms
specified at http://www.microsoft.com/info/cpyright.htm

Nov 17 '05 #3
Derrick,

I made additional tests and I'm gonna put here the facts of the situation.
Perhaps you can give me some orientation on what is the problem and/or what
to do based on these details.

1. I renamed the extension of the "info.asp" file to "info.aaa". The file
was moved with no problem. Also, I renamed another file and put it as an ASP
file and the routine raised the same exception. So based on this, we know
the problem occurs with any ASP files, not particularly with the info.asp.

2. All other files are moved without any problem.

3. The problem occurs on any folder (acting as source folder), even though
that folder is not configured as a virtual directory in IIS.

4. ASPNET user has all permissions on both folders.

What do you suggest? I think it has to be something with the fact that it
is a ASP file, not necessarily permissions on the folder, so I believe this
can be solved looking into the configuration in IIS or any other place in
Windows (remember this was working 2 months ago, so may be some configuration
was changed without my knowledge).

What do you think?

Thanks.

--
Carlitos
"Carlitos" wrote:
Hello Derrick,

Thanks for the response. Yesterday I made a test. Instead of uploading the
zip and unzipping it into a subfolder of the Web Application, I made the same
process into a folder outside the Web Application folder (c:\upload), but got
the same error "Access...denied". I'm gonna try to look using the tool you
suggested and let you know what's the outcome.

Many thanks.

--
Carlitos
"Derrick Coetzee [MSFT]" wrote:
Carlitos wrote:
In a test I am doing, there is a zip file with +200 files in it. The
routine that moves the unzipped files works just fine until it reaches the
108th file. It throws a "Access to the path is denied" exception when it
tries the MoveTo method on that file.

[ . . . ]

The file that the routine tries to move and fails is a ASP file
("info.asp"). Does that got anything to do with the problem? If it does,
then how come this was working 2 months ago, and now it is not? Is it
perhaps some sort of configuration that had been changed without me knowing
it?


From a cursory inspection, your routine looks fine. From the name of the
ASP file, my guess is that the file is in use by another process. Try and
use Sysinternal's Filemon to get a better impression of who's messing with
these files just prior to the error:

http://www.sysinternals.com/Utilities/Filemon.html

Please write back if you're still having trouble tracking this down. Good luck.
--
Derrick Coetzee, MCP, MSFT (Speech Server)
This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included code samples are subject to the terms
specified at http://www.microsoft.com/info/cpyright.htm

Nov 17 '05 #4
"Carlitos" <Ca******@discussions.microsoft.com> wrote:
I renamed the extension of the "info.asp" file to "info.aaa". The file
was moved with no problem. Also, I renamed another file and put it as an
ASP
file and the routine raised the same exception. So based on this, we know
the problem occurs with any ASP files, not particularly with the info.asp.
[ . . . ]
What do you suggest? I think it has to be something with the fact that it
is a ASP file, not necessarily permissions on the folder, so I believe
this
can be solved looking into the configuration in IIS or any other place in
Windows (remember this was working 2 months ago, so may be some
configuration
was changed without my knowledge).


Hi again Carlitos, sorry for the slow response.

I've investigated this issue for some time, but I'm sorry to say that I'm
not sure what's going on. It's evident that the problem is only occurring
with files with the .asp extension; it's possible that ASP.NET is specially
restricting deletion of these files for some reason, but I haven't been able
to find any setting capable of doing this. You might try a reinstall of
ASP.NET, which you can perform from the Add/Remove Windows Components panel.
You might also try a forum specifically oriented towards ASP.NET. Sorry that
I couldn't be more helpful.
--
Derrick Coetzee, MCP, MSFT (Speech Server)
This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included code samples are subject to the terms
specified at http://www.microsoft.com/info/cpyright.htm
Nov 17 '05 #5

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

Similar topics

0
by: Oliver | last post by:
hi - I have a written a "Serviced Component" which works fine when declared as: but I am seeing an 'Access Denied' exception when I declare it as: this is probably something to do with...
0
by: Oliver | last post by:
> I am seeing an 'Access Denied' exception when using a "Server" "Serviced Component" >> ..are...registered in the GAC ? yes. >> ..are...the parameters serializable? um - parameters? - the...
1
by: ±ù÷¢ | last post by:
I have a standard vb crystal reports viewer control on a web form with just the one simple report bound to it. when I run the project I get the following error: ACCESS TO THE PATH...
1
by: Winterminute | last post by:
If I try to make any changes to the ASP.NET Portal Starter kit it fails with an access denied error. This was working when I left last week and is failing today. I don't remember changing...
6
by: ASP.Confused | last post by:
I have an ASP.NET page writtein in VB that uses ADODB. I just had to force-install MDAC 2.8 after I tried to rollback to 2.6 (my web host uses this, and I wanted to be compatible with them.) I...
0
by: ASP.Confused | last post by:
The old message looked a little stale, so I am re-posting it here. Anybody have any ideas of what I could do?!? The previous responses to this question are below. If you want to look at the...
1
by: VB Programmer | last post by:
When I run this line: Dim sw As New System.IO.StreamWriter(strFileName) I get this error: System.UnauthorizedAccessException: Access to the path...
2
by: job | last post by:
In a sharepoint setup using smartpart to load our user controls using enterprise blocks (data) we are getting some strange errors (logged to the event log). We dont get the error all the time. When...
1
by: jalupinu | last post by:
My OS is Winxp SP2 and the software I am having trouble with is Maximizer 9.5 Enterprise. It has a Web Portal feature that i am trying to use and followed the instructions to set it up however I keep...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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...
0
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...

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.