Hi,
I want to upload *.jpg files to server using FileUpload control. Hosting is
shared and administrator informed me that I have to use medium trust level
to upload files. How to achieve that?
I get error:
: The application attempted to perform an operation not allowed by the
security policy. To grant this application the required permission please
contact your system administrator or change the application's trust level in
the configuration file.
Line 10: FileUpload1.SaveAs("\images\res\" & FileUpload1.FileName)I
am new to ASP.NET ?
Thanks a lot!
Domac
Peter Bromberg [C# MVP] - 11 Apr 2008 16:40 GMT
You have to grant write permissions on the images folder to the ASPNET or
whatever account your app is running under.
Peter
> Hi,
>
[quoted text clipped - 14 lines]
> Thanks a lot!
> Domac
Alexey Smirnov - 12 Apr 2008 08:37 GMT
> Hi,
>
[quoted text clipped - 14 lines]
> Thanks a lot!
> Domac
MSDN: "For a call to the SaveAs to work, the ASP.NET application must
have write access to the directory on the server. There are two ways
that the application can get write access. You can explicitly grant
write access to the account under which the application is running, in
the directory in which the uploaded files will be saved.
Alternatively, you can increase the level of trust that is granted to
the ASP.NET application."
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.sa
veas(VS.80).aspx
http://msdn2.microsoft.com/en-us/library/wyts434y(VS.80).aspx
Hope this helps