File upload problem

D

Domac

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
 
P

Peter Bromberg [C# MVP]

You have to grant write permissions on the images folder to the ASPNET or
whatever account your app is running under.
Peter
 
G

Guest

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

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.saveas(VS.80).aspx
http://msdn2.microsoft.com/en-us/library/wyts434y(VS.80).aspx

Hope this helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

File Upload. Root Path. 2
trust level problem 1
file upload 2
File Upload Folder Permissions 5
File Upload Problem 2
File Upload weirdness... 2
Security Exception 0
Debug Session on localhost 5

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top