本文介绍了如何创建一个新文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
—SA
You can use System.IO.Directory.CreateDirectory, msdn.microsoft/en-us/library/system.io.directory.aspx[^].
One problem you might have is finding out right path name to be passes for a directory name parameter. Please read this:
msdn.microsoft/en-us/library/ms178116.aspx[^].
—SA
如何使用c#在asp 4.0中创建具有访问控制的新文件夹,请帮助我.
How to create a new folder with access control in asp 4.0 using c#, please help me.
推荐答案您可以使用System.IO.Directory.CreateDirectory, msdn.microsoft/en-us/library/system.io.directory. aspx [^ ]. 您可能遇到的一个问题是找出要传递的正确路径名,以获取目录名参数.请阅读以下内容: msdn.microsoft/en-us/library/ms178116.aspx [ ^ ].
尝试:- msdn.microsoft/en-us/library/system.io. directory.aspx [^ ] www.dotnetperls/directory-createdirectory [ ^ ] en.csharp-online/Create_a_directory [ ^ ] www.dotnetspider/resources/7625-Directory- Create-Check-Delete-Using-C.aspx [ ^ ] 不要忘记使用 try this :- msdn.microsoft/en-us/library/system.io.directory.aspx[^] www.dotnetperls/directory-createdirectory[^] en.csharp-online/Create_a_directory[^] www.dotnetspider/resources/7625-Directory-Create-Check-Delete-Using-C.aspx[^] dont forget to add using System.IO;
命名空间添加. 如果可以帮助您,请别忘了将此标记为您的答案. 谢谢
name space. Don''t forget to mark this as your answer if it helps you out. Thanks
虽然ASP .NET框架已经提供了对基于角色的访问控制(RBAC)的支持,但是我们可以使用成员资格类. While ASP .NET framework already provides support for role based access control (RBAC), we can use the membership classes. public class User { public string Name { get; set; } public int Role { get; set; } public bool IsInRole(Role role) { Role userRole = (Role)this.Role; return ((userRole & role) == role); } } [Flags] public enum Role { Associate = 1, Manager = 2 }
用户界面代码为:
User Interface code as:
<div class="LeftMenu"> <% if (user.IsInRole(Role.Manager)) %> <% thisDir = Server.MapPath("."); System.IO.Directory.CreateDirectory(thisDir + "\\NewFolder1"); %> </div>
更多推荐
如何创建一个新文件夹
发布评论