Board index » Web Programming » Security-exception when performing File.Move()

Security-exception when performing File.Move()

Web Programming295
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


-
 

Re:Security-exception when performing File.Move()



"Fredrik Arenhag" <fredrik.arenhag@reallife.se>wrote in message

Quote
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" rel="nofollow" target="_blank">hintsandtips.com/hat.aspx=ShowTip&C=31&F=100&T=5





--

Rocky Moore

www.HintsAndTips.com





-

Re:Security-exception when performing File.Move()

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.



"Fredrik Arenhag" <fredrik.arenhag@reallife.se>wrote in message

Quote
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





-

Re:Security-exception when performing File.Move()

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





Rocky Moore wrote:

Quote
"Fredrik Arenhag" <fredrik.arenhag@reallife.se>wrote in message

news:#$MWSSc2DHA.2888@tk2msftngp13.phx.gbl...



>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" rel="nofollow" target="_blank">hintsandtips.com/hat.aspx=ShowTip&C=31&F=100&T=5





--

Rocky Moore

www.HintsAndTips.com





-