ASP:FileUpload.. wont

  • Thread starter Thread starter musosdev
  • Start date Start date
M

musosdev

Hi guys

This is a repost as I haven't managed to fix the problem yet. I really hope
someone can help as I'm stuck.

I have an asp:fileupload component on a page, and it's giving the following
security exception...

ERROR: Request for the permission of type
'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Even though I have again set the Modify and Write permissions for the
NETWORK SERVICE account on the directory.

I've checked the permissions and Network Service has full control. I've also
added every other User in the permissions to full control and that doesn't
help.

Interestingly, if I create a file with System.IO.File.Create()... it works.
With the same path as I'm using in the FileUpload.

Also, I was advised to check the Environment.User variable, but I get the
same security exception when I try to write that out with Response.Write

Please can someone shed any more light on this? Work are pushing for
completion and I have absolutely no idea whats wrong.

Thanks, Dan.
 
Interestingly, if I create a file with System.IO.File.Create()... it
works. With the same path as I'm using in the FileUpload.

Maybe the permission problem occurs in some temporary system folder - not
in your data folder. When the file is uploaded from the client, it *might*
be that the IIS or the ASP.NET core stores the file in a central location
for you to pick it up. I do not know this.

Some ideas for testing:

1) Is the exception thrown when uploading the file, even if you remove the
part of the code that actually saves the file to your data folder?

2) If no: are you able to loop through the contents of the posted file in
your code, if you do so without storing it on disk first?
 
Try to give permissions to this folder to following account
1. IIS_WPG

If this does not work try those
ASPNET
IUSR_XXXX
IWAM_XXXXX


George
n

Give permissios to IIS
 
Back
Top