System.Security.Permissions.FileIOPermission例外,尽管信任度满 [英] System.Security.Permissions.FileIOPermission exception even though trust level is full

查看:1821
本文介绍了System.Security.Permissions.FileIOPermission例外,尽管信任度满的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一些图片上传到服务器。但是,当我尝试上载,它抛出这个错误:

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.

我查了这一点:<一href=\"http://stackoverflow.com/questions/2078147/webpermission-exception-even-though-im-in-full-trust\">WebPermission例外,即使我在完全信任

不过因为我的应用程序是一个托管公司,我不能更改IIS设置。我给WITE权限的文件夹。而在我的web.config文件我有这个code:

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>

你有什么建议吗?

推荐答案

如果你在哪里要上传图片的文件夹,是你的私有/专用服务器托管然后设置写入权限。
在共享主机你不能写,因此你需要在一个特定的目录设置写入权限的所有文件夹,主要是我们需要问的托管服务提供商启用写入权限,否则例外是显而易见的。

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

这篇关于System.Security.Permissions.FileIOPermission例外,尽管信任度满的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆