By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,172 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,172 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.