views:

156

answers:

0

Possible Duplicate

File I/O in medium trust?

I get the following error when I try to upload a file from a web page:

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

The web application runs on ASP.NET Framework 3.5 under 'Medium Trust' trust level.

The source code that saves the file in to a sub folder of the web application is the following:

Request.Files[myProfileImage.UniqueID].SaveAs(Server.MapPath("/images/test.gif"));

The code works fine in my development environment but gives the above error when hosted with GoDaddy shared Windows hosting.

Any clue how I could upload a file from a web page under Medium Trust? Thanks in advance. cheers.