本文介绍了映射到用户主目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在尝试编写一个asp或aspx页面,它将为用户Active Directory 主目录创建一个虚拟ftp目录。这样一来,用户可以通过IE与ftp网站的文件夹视图进行交互(拖放, 复制/粘贴)。 我有一些代码,似乎是片状的它适用于我和其他人,但不是每个人。我真的需要 获得一个稳定的版本。我的asp代码如下。在ASP中获得是好的,但是拥有一个可靠的 ASPX(ASP.net)解决方案将是一个额外的好处。 我遇到的一个问题是非常好的,但是我不确定它是否可以修复和 这是安全性虚拟目录和文件。 我更希望当用户在 网络上工作并使用他们的AD帐户登录时他们是 不会受到身份验证的挑战,但我无法获得获取request.ServerVariables(" AUTH_PASSWORD")"方法 除非使用基本身份验证,否则需要 用户才能登录。我不知道这是否可以在ASP.net中避免使用,但是如果我可以使用一个aspx页面可以获得密码而无需解密或其他任何内容 将是理想的。无论如何,这是我的代码: --------------------------------- ------------------------- ----------------- -------- <% strFullUserName = request.ServerVariables(" AUTH_USER") strUserPass = request.ServerVariables(" AUTH_PASSWORD") strWebServer = request.ServerVariables(" SERVER_NAME") strWebServerIP = request.ServerVariables(" LOCAL_ADDR") ''拆分域名和用户名 strUserDomain = strFullUserName strUserDomain = Mid(strFullUserName,1,Instr (strFullUserName," \") - 1) strUserDomainLength = len(strUserDomain) strFullUserNameLength = Len(strFullUserName) strUserName = Right(strFullUserName, strFullUserNameLength - strUserDomainLength -1) 设置objUser = GetObject(" WinNT://" ;& strUserDomain&" /" & strUserName,user) strUserHome = objUser.homeDirectory strVD =" ftp://" &安培; strWebServer& " /" On Error Resume Next 设置IISOBJ = GetObject (" IIS:// Localhost / MSFTPSVC / 1 / Root") 设置NewDir = IISOBJ.Create(" IIsFtpVirtualDir", strUserName) 错误.Number = 0 NewDir.Path = strUserHome NewDir.AccessRead = True NewDir.AccessWrite = True NewDir.UNCUserName = strfullUserName NewDir.UNCPassword = strUserPass NewDir.SetInfo 设置NewDir = Nothing 设置IISObJ = Nothing Response.Redirect(" ftp:// testportal") ''response.write("你的P驱动器已映射 成功!"&"< a href ="" ftp:// testportal /"">点击 这里< / a>< br> ;") %> 解决方案 。 I am trying to write an asp or aspx page that will createa virtual ftp directory to the users Active Directoryhome directory. That way a user can interact (drag/drop,copy/paste) via IE with folder view for ftp sites.I have some code, that seems to be "flaky" it works forme and some others, but not everyone. I really need toget a stable version. My asp code is below. Having itin ASP is fine, but it would be a bonus to have a solidASPX (ASP.net) solution.There is one issue I have ran into that is prettyannoying, and I am not sure if it can be fixed or not andthat is the security of the virtual directory and file.I would prefer that when the user is at work on thenetwork and logged in with their AD account that theywould not be challenged to authenticate, but I could notget the "request.ServerVariables("AUTH_PASSWORD")" methodto work unless Basic Authentication is used, requiringthe user to login. I do not know if this can be avoidedin ASP.net, but if I can use an aspx page that can getthe password without having to decrypt or whatever thatwould be ideal. Anyway, here is the code I have:-----------------------------------------------------------------------------------<%strFullUserName = request.ServerVariables("AUTH_USER")strUserPass = request.ServerVariables("AUTH_PASSWORD")strWebServer = request.ServerVariables("SERVER_NAME")strWebServerIP = request.ServerVariables("LOCAL_ADDR")''Split domain and usernamestrUserDomain = strFullUserNamestrUserDomain = Mid (strFullUserName, 1, Instr(strFullUserName, "\")-1)strUserDomainLength = len(strUserDomain)strFullUserNameLength = Len(strFullUserName)strUserName = Right (strFullUserName,strFullUserNameLength - strUserDomainLength -1)Set objUser = GetObject("WinNT://" & strUserDomain & "/"& strUserName, user)strUserHome = objUser.homeDirectorystrVD = "ftp://" & strWebServer & "/"On Error Resume NextSet IISOBJ = GetObject("IIS://Localhost/MSFTPSVC/1/Root")Set NewDir = IISOBJ.Create("IIsFtpVirtualDir",strUserName)Error.Number = 0NewDir.Path = strUserHomeNewDir.AccessRead = TrueNewDir.AccessWrite = TrueNewDir.UNCUserName = strfullUserNameNewDir.UNCPassword = strUserPassNewDir.SetInfoSet NewDir=NothingSet IISObJ=NothingResponse.Redirect( "ftp://testportal" )''response.write ("Your P Drive Was MappedSuccessfully!"& "<a href=""ftp://testportal/"">ClickHere</a><br>")%> 解决方案. 这篇关于映射到用户主目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 06-14 19:39