1

I am trying to upload some pics to server. But when I try to upload, it throws this error:

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

I checked this : WebPermission Exception even though I'm in Full trust

But I can't change IIS settings because my application is in a hosting company. I gave wite permissions to folder. And in my web.config file I have this code :

 <location allowOverride="true" path="ProductImages">
<system.web>
  <trust level="Full" originUrl=""  />
</system.web>

Do you have any suggestions for me?

Community
  • 1
  • 1
cagin
  • 5,772
  • 14
  • 74
  • 130
  • I contact with my hosting company. They told me that, my project is in a Middle Trust Server. They Said that, if you want to solve this problem we should move your project to a Full Trust server. I told them, I could upload images to server before but now I can not, but they couldn't find any other solution. I will create an answer in here when I solve my problem. Thanks alot for your suggestions. – cagin Aug 03 '12 at 08:55

2 Answers2

0

Give user WRITE permission to the folder where you are uploading to.

Yasser Shaikh
  • 46,934
  • 46
  • 204
  • 281
0

If its your private/dedicate hosting server then set write permission on the folder where you are want to upload images. In shared hosting you are not allowed to write to all folders hence you need to set write permissions on a specific directory, mostly we need to ask hosting provider to enable write permissions otherwise the exception is obvious

Munawar
  • 2,588
  • 2
  • 26
  • 29