如何使用asp.net代码授予目录权限 [英] how to grant directory permission using asp.net code

查看:69
本文介绍了如何使用asp.net代码授予目录权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用代码动态创建一个日期文件夹,现在我想授予它权限,以便我可以上传图像......

plz建议我....

解决方案

我讨论了问题评论中的位置,因为我害怕一个非常常见的错误:尝试访问服务器端站点根目录之外的文件系统对象。但是,您需要检查位置是否正确并且您正确计算它。您需要使用 System.Web.HttpServerUtility.MapPath [ ^ ]。



如果您确实需要解决文件/目录权限,请参阅:

http://msdn.microsoft.com/en-us/library/5ba4k1c5.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.security.permissions.fileiopermission.aspx [ ^ ]。



-SA

hello everyone,
I am creating a date-wise folder dynamically using code, now I want to grant permission to it so that i can upload images in it......
plz suggest me....

解决方案

I discussed the location in the comments to the question because I was afraid about one very usual mistake: trying to access file system objects outside the root directory of the site on server side. Still, you need to check up if the location is correct and you correctly calculate it. You need to use System.Web.HttpServerUtility.MapPath: http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.mappath.aspx[^].

If you really need to address file/directory permission, please see:
http://msdn.microsoft.com/en-us/library/5ba4k1c5.aspx[^],
http://msdn.microsoft.com/en-us/library/system.security.permissions.fileiopermission.aspx[^].

—SA


这篇关于如何使用asp.net代码授予目录权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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