如何创建一个新文件夹

编程入门 行业动态 更新时间:2024-10-24 02:36:21
本文介绍了如何创建一个新文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何使用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 [ ^ ].
—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

尝试:- 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>

更多推荐

如何创建一个新文件夹

本文发布于:2023-10-30 19:30:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1543787.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:创建一个   文件夹

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!