Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

File upload problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Domac - 11 Apr 2008 08:17 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.