真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb.net文件權(quán)限 vbnet filestream

關(guān)于VB.net兩個(gè)問(wèn)題 1.按著指定的文件格式刪除文件 2.獲得某文件或文件夾的權(quán)限 要求代碼

kill app.path "\**.txt" 刪除同級(jí)目錄的所有txt文本文件

我們提供的服務(wù)有:成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、微信公眾號(hào)開(kāi)發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、欒川ssl等。為1000+企事業(yè)單位解決了網(wǎng)站和推廣的問(wèn)題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的欒川網(wǎng)站制作公司

獲取文件權(quán)限干嗎?

結(jié)合上面那個(gè)刪除文件,你是想做一個(gè)木馬類文件搗亂吧?那就不給你獲取權(quán)限了,給你個(gè)遍歷文件權(quán)限的,如果你能從代碼里舉一反三寫出獲取權(quán)限來(lái),算你厲害。

Sub GetFiles(ByVal ParentFolder As String)

Try

Dim sFolders(), sFiles() As String

sFolders = IO.Directory.GetDirectories(ParentFolder)

For Each sFolder As String In sFolders

GetFiles(sFolder)

'Call AddPath("dir", sFolder)

Debug.Print(sFolder)

Application.DoEvents()

Next

sFiles = IO.Directory.GetFiles(ParentFolder)

For Each sFile As String In sFiles

Debug.Print(sFile)

'AddPath("file", sFile)

'lgCount = lgCount + 1

Application.DoEvents()

Next

Catch ex As Exception

End Try

End Sub

vb.net windows7下設(shè)置程序管理員權(quán)限(會(huì)的進(jìn))

VB.net(VS2008)里面比C#還好弄,不需要自己加manifest,直接在項(xiàng)目屬性的“應(yīng)用程序”里面點(diǎn)擊“查看UAC設(shè)置”,在新打開(kāi)的app.manifest里面把 requestedExecutionLevel level="asInvoker" uiAccess="false" / 替換成 requestedExecutionLevel level="requireAdministrator" uiAccess="false" / 再編譯就行了。

vb.net 操作文件夾用戶權(quán)限

'

' 需要添加以下命名空間:

' Imports System.IO

' Imports System.Security.AccessControl

' */

Dim sPath As String = Server.MapPath(文件夾名稱字符串)

Directory.CreateDirectory(sPath)

addpathPower(sPath, "ASPNET", "FullControl")

'////////////////////////////////////////////////

Public Sub addpathPower(ByVal pathname As String, ByVal username As String, ByVal power As String)

Dim dirinfo As DirectoryInfo = New DirectoryInfo(pathname)

If (dirinfo.Attributes FileAttributes.ReadOnly) 0 Then

dirinfo.Attributes = FileAttributes.Normal

End If

'取得訪問(wèn)控制列表

Dim dirsecurity As DirectorySecurity = dirinfo.GetAccessControl()

Select Case power

Case "FullControl"

dirsecurity.AddAccessRule(New FileSystemAccessRule(uername,FileSystemRights.FullControl,InheritanceFlags.ContainerInherit,PropagationFlags.InheritOnly,AccessControlType.Allow))

Exit Sub

Case "ReadOnly"

dirsecurity.AddAccessRule(New FileSystemAccessRule(username,FileSystemRights.Read,AccessControlType.Allow))

Exit Sub

Case "Write"

dirsecurity.AddAccessRule(New FileSystemAccessRule(username,FileSystemRights.Write,AccessControlType.Allow))

Exit Sub

Case "Modify"

dirsecurity.AddAccessRule(New FileSystemAccessRule(username,FileSystemRights.Modify,AccessControlType.Allow))

Exit Sub

End Select

dirinfo.SetAccessControl(dirsecurity)

End Sub


分享標(biāo)題:vb.net文件權(quán)限 vbnet filestream
URL標(biāo)題:http://weahome.cn/article/doihsjc.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部