S
scmiles
I am trying to write an asp or aspx page that will create
a virtual ftp directory to the users Active Directory
home 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 for
me and some others, but not everyone. I really need to
get a stable version. My asp code is below. Having it
in ASP is fine, but it would be a bonus to have a solid
ASPX (ASP.net) solution.
There is one issue I have ran into that is pretty
annoying, and I am not sure if it can be fixed or not and
that is the security of the virtual directory and file.
I would prefer that when the user is at work on the
network and logged in with their AD account that they
would not be challenged to authenticate, but I could not
get the "request.ServerVariables("AUTH_PASSWORD")" method
to work unless Basic Authentication is used, requiring
the user to login. I do not know if this can be avoided
in ASP.net, but if I can use an aspx page that can get
the password without having to decrypt or whatever that
would 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 username
strUserDomain = strFullUserName
strUserDomain = 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.homeDirectory
strVD = "ftp://" & strWebServer & "/"
On Error Resume Next
Set IISOBJ = GetObject
("IIS://Localhost/MSFTPSVC/1/Root")
Set NewDir = IISOBJ.Create("IIsFtpVirtualDir",
strUserName)
Error.Number = 0
NewDir.Path = strUserHome
NewDir.AccessRead = True
NewDir.AccessWrite = True
NewDir.UNCUserName = strfullUserName
NewDir.UNCPassword = strUserPass
NewDir.SetInfo
Set NewDir=Nothing
Set IISObJ=Nothing
Response.Redirect( "ftp://testportal" )
'response.write ("Your P Drive Was Mapped
Successfully!"& "<a href=""ftp://testportal/"">Click
Here</a><br>")
%>
a virtual ftp directory to the users Active Directory
home 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 for
me and some others, but not everyone. I really need to
get a stable version. My asp code is below. Having it
in ASP is fine, but it would be a bonus to have a solid
ASPX (ASP.net) solution.
There is one issue I have ran into that is pretty
annoying, and I am not sure if it can be fixed or not and
that is the security of the virtual directory and file.
I would prefer that when the user is at work on the
network and logged in with their AD account that they
would not be challenged to authenticate, but I could not
get the "request.ServerVariables("AUTH_PASSWORD")" method
to work unless Basic Authentication is used, requiring
the user to login. I do not know if this can be avoided
in ASP.net, but if I can use an aspx page that can get
the password without having to decrypt or whatever that
would 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 username
strUserDomain = strFullUserName
strUserDomain = 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.homeDirectory
strVD = "ftp://" & strWebServer & "/"
On Error Resume Next
Set IISOBJ = GetObject
("IIS://Localhost/MSFTPSVC/1/Root")
Set NewDir = IISOBJ.Create("IIsFtpVirtualDir",
strUserName)
Error.Number = 0
NewDir.Path = strUserHome
NewDir.AccessRead = True
NewDir.AccessWrite = True
NewDir.UNCUserName = strfullUserName
NewDir.UNCPassword = strUserPass
NewDir.SetInfo
Set NewDir=Nothing
Set IISObJ=Nothing
Response.Redirect( "ftp://testportal" )
'response.write ("Your P Drive Was Mapped
Successfully!"& "<a href=""ftp://testportal/"">Click
Here</a><br>")
%>