Security-exception when performing File.Move()

  • Thread starter Thread starter Fredrik Arenhag
  • Start date Start date
F

Fredrik Arenhag

Hi!

I'm in the process of writing a ASP.NET-application in VB.NET where a
(at this stage) not logged in user is supposed to be able to move a file
from one location to another on the servers harddrive, File.Move().

I've read through loads of guides and they all say "Add
write-permissions to your ASPNET-account".
Well, I've done this - and way more. I've even tried to add the
ASPNET-account to the Administrators-group, but still no success.
All I get is:
System.UnauthorizedAccessException: Access to the path
"C:\Inetpub\wwwroot\filePermissionTest\test_ikon2.gif" is denied.

By now I'm beginning to wonder what it is that I'm missing. I've
restarted the W3SVC-service to see if there were any cached settings
left, but obviously not.

I've also checked the "Write"-checkbox in the dialog for the application
under the IIS-console, but nothing there either. =(

Does anyone have any idea what so ever what setting it is that I've missed?

TIA!
Fredrik Arenhag
 
Fredrik Arenhag said:
Hi!

I'm in the process of writing a ASP.NET-application in VB.NET where a
(at this stage) not logged in user is supposed to be able to move a file
from one location to another on the servers harddrive, File.Move().

I've read through loads of guides and they all say "Add
write-permissions to your ASPNET-account".
Well, I've done this - and way more. I've even tried to add the
ASPNET-account to the Administrators-group, but still no success.
All I get is:
System.UnauthorizedAccessException: Access to the path
"C:\Inetpub\wwwroot\filePermissionTest\test_ikon2.gif" is denied.

By now I'm beginning to wonder what it is that I'm missing. I've
restarted the W3SVC-service to see if there were any cached settings
left, but obviously not.

I've also checked the "Write"-checkbox in the dialog for the application
under the IIS-console, but nothing there either. =(

Does anyone have any idea what so ever what setting it is that I've missed?

TIA!
Fredrik Arenhag

You might check the permissions that is actually being used, it might point
to something.

http://hintsandtips.com/hat.aspx?P=ShowTip&C=31&F=100&T=5
 
One possibility: A file is locked while an application has it opened. Did
your app create or open the file and not close it at some point? Is it
possible that some other application is using it?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Thank you very much for your tip, it has brought me one step closer to
my target!

On my WinXP machine it told me that it was the ASPNET-account which was
being used and through that I could resolve the problem.

However, when doing this on my Win2k3-server it tells me that it's the
"NT AUTHORITY\NETWORK SERVICE" that's being used. Adding rights for this
account as I did for the ASPNET-account on my own machine didn't help.
So I guess I'm stuck again =(

Any more tips up your sleeve? =)

/
Fredrik Arenhag
 
Back
Top