错误产生的行是:Set newfolder = filesys.CreateFolder(Server.MapPath(newfolderpath))
。
下面是代码:
If Request.Form("add")= "true" then
Dim prop, user, pwd, dir
prop = ChkString(request.Form("Prop"))
user = ChkString(request.Form("User"))
pswd = ChkString(request.Form("Pswd"))
dir = ChkString(request.Form("Dir"))
Dim filesys, newfolder, newfolderpath
newfolderpath = "/ppi/"& dir
set filesys=CreateObject("Scripting.FileSystemObject")
If filesys.FolderExists(Server.MapPath(newfolderpath)) = true Then
Response.Write("<center><br><br><span class='bodybigred'>Sorry, this folder already exists.</span><br><br><span class='bodybig'><a href='javascript:history.go(-1)'>Please try again</a></span><br><br><br><br><br><br></center>")
Else
Set newfolder = filesys.CreateFolder(Server.MapPath(newfolderpath))
SQL = "INSERT INTO PPI " &_
" (Property_Name, Username, Passwd, PPI_Dir) " &_
"VALUES ('" & prop & "','" & user & "','" & pswd & "','" & dir & "');"
Conn.Execute SQL
Conn.Close
Set Conn = Nothing
Set filesys = Nothing
Response.Redirect "ppi.asp?view=all&prop=" & prop & "&posted=true"
End If
End If
答案1
我将 IUSR 用户和 IIS_IUSRS(适用于 IIS 7)添加到目录/文件夹中以设置文件系统权限。