to spring_ok(SpringDotNet).照你的方法做,还是无效。 我这样写的: Dim path As String = "\\server\e$\ghost.exe" Dim permission As New FileIOPermission(FileIOPermissionAccess.Write, path) Try permission.Demand() Catch exp As System.Security.SecurityException Response.Write("<script>alert('您没有权限写入数据!')</script>") Catch exp As Exception Response.Write("<script>alert('未知错误!' " + exp.Message + ")</script>") End Try 'Try File.Copy("c:\ghost.exe", path) 它在第一个try catch块中不报错,说明我有写入的权限。但是运行到file.copy时,就抛出了上述的错误. ?????
我换了一种办法: Dim objWebClient As New WebClient() Dim btResponse As Byte() btResponse = objWebClient.UploadFile("file:\\server\d$", "c:\ghost.exe") Response.Write(btResponse) 还是同样的错误:无法更新密码。提供给新密码的值包含密码中不允许的值。
将WEB服务器的aspnet用户添加到网络服务器server的对应目录的安全属性中并允许写该目录。
另外,不要使用 d$ 这样的为管理目的设置的共享目录,为D盘新建一个共享名称。仅供参考。
1.修改 aspnet用户的密码,要记住这个密码。
2.修改 machine.config 文件中 <processModel 部分的 password 为你的新密码,原来是 AutoGenerate.目标服务器:
1.建立一个 ASPNET用户,设置其密码与 web服务器中的密码一样。
2.设置 ASPNET用户对目标目录有写入权限。
我这样写的:
Dim path As String = "\\server\e$\ghost.exe"
Dim permission As New FileIOPermission(FileIOPermissionAccess.Write, path)
Try
permission.Demand()
Catch exp As System.Security.SecurityException
Response.Write("<script>alert('您没有权限写入数据!')</script>")
Catch exp As Exception
Response.Write("<script>alert('未知错误!' " + exp.Message + ")</script>")
End Try
'Try
File.Copy("c:\ghost.exe", path)
它在第一个try catch块中不报错,说明我有写入的权限。但是运行到file.copy时,就抛出了上述的错误.
?????
File.Copy("\\computer1\d$\ghost.exe","d:\ghost.exe" )
computer1如何设置共享等安全性????
是NT40(在Win2000下也试过,不行)
Dim btResponse As Byte()
btResponse = objWebClient.UploadFile("file:\\server\d$", "c:\ghost.exe")
Response.Write(btResponse)
还是同样的错误:无法更新密码。提供给新密码的值包含密码中不允许的值。