It was suggested by Azure folks that we create a virtual LAN with RemoteApp users accessing files on a server.
Besides the cost and performance issues that Rick brought up, this adds the issue of how to manage ActiveDirectory users programmatically.
We are not very savvy in .NET and would prefer to do it from VFP. Anybody knows what options exist?
TIA,
Alex
You can program ActiveDirectory via DirectoryServices and COM from FoxPro. I have some code posted somewhere. Look for ADSI and ActiveDirectory. Been a long time and it's a pain in the ass because you have to do extensive error checking.
It might actually be easier to do this with .NET and wwDotnetBridge as the .NET apis are more fault tolerant and make capturing errors easier.
+++ Rick ---
We want to host a VFP app on the cloud and provide access with RDS (formerly Terminal Services) and RemoteApp.
It was suggested by Azure folks that we create a virtual LAN with RemoteApp users accessing files on a server.
Besides the cost and performance issues that Rick brought up, this adds the issue of how to manage ActiveDirectory users programmatically.
We are not very savvy in .NET and would prefer to do it from VFP. Anybody knows what options exist?
TIA,
Alex
West Wind Technologies
Making waves on the Web
from Maui
Doing it with .NET and wwDotnetBridge sounds good, but assumes there is a .NET application to do the job which we control using wwDotNetBridge. Do you know of an application I could use for this purpose?
Alex
You can program ActiveDirectory via DirectoryServices and COM from FoxPro. I have some code posted somewhere. Look for ADSI and ActiveDirectory. Been a long time and it's a pain in the ass because you have to do extensive error checking.
It might actually be easier to do this with .NET and wwDotnetBridge as the .NET apis are more fault tolerant and make capturing errors easier.
+++ Rick ---
We want to host a VFP app on the cloud and provide access with RDS (formerly Terminal Services) and RemoteApp.
It was suggested by Azure folks that we create a virtual LAN with RemoteApp users accessing files on a server.
Besides the cost and performance issues that Rick brought up, this adds the issue of how to manage ActiveDirectory users programmatically.
We are not very savvy in .NET and would prefer to do it from VFP. Anybody knows what options exist?
TIA,
Alex
In Web Connection there's a WebServer.vcx class that includes a ActiveDirectory class that you can use to do most of this actually. It doesn't use .NET - just uses the ADSI directory services directly. Somewhere I've posted some code to do user administration with this stuff but I can't find it. If you do some searching here on the message board or on the UT you might run into it.
Either way managing the AD using these antiquated interfaces is a pain - the .NET stuff is a little easier but if you use wwDotnetBridge it'll also be messy. In .NET the access for this lives in DirectoryServices.
+++ Rick ---
Thanks Rick.
Doing it with .NET and wwDotnetBridge sounds good, but assumes there is a .NET application to do the job which we control using wwDotNetBridge. Do you know of an application I could use for this purpose?
Alex
You can program ActiveDirectory via DirectoryServices and COM from FoxPro. I have some code posted somewhere. Look for ADSI and ActiveDirectory. Been a long time and it's a pain in the ass because you have to do extensive error checking.
It might actually be easier to do this with .NET and wwDotnetBridge as the .NET apis are more fault tolerant and make capturing errors easier.
+++ Rick ---
We want to host a VFP app on the cloud and provide access with RDS (formerly Terminal Services) and RemoteApp.
It was suggested by Azure folks that we create a virtual LAN with RemoteApp users accessing files on a server.
Besides the cost and performance issues that Rick brought up, this adds the issue of how to manage ActiveDirectory users programmatically.
We are not very savvy in .NET and would prefer to do it from VFP. Anybody knows what options exist?
TIA,
Alex
West Wind Technologies
Making waves on the Web
from Maui
In Web Connection there's a WebServer.vcx class that includes a ActiveDirectory class that you can use to do most of this actually. It doesn't use .NET - just uses the ADSI directory services directly. Somewhere I've posted some code to do user administration with this stuff but I can't find it. If you do some searching here on the message board or on the UT you might run into it.
Either way managing the AD using these antiquated interfaces is a pain - the .NET stuff is a little easier but if you use wwDotnetBridge it'll also be messy. In .NET the access for this lives in DirectoryServices.
+++ Rick ---
Thanks Rick.
Doing it with .NET and wwDotnetBridge sounds good, but assumes there is a .NET application to do the job which we control using wwDotNetBridge. Do you know of an application I could use for this purpose?
Alex
You can program ActiveDirectory via DirectoryServices and COM from FoxPro. I have some code posted somewhere. Look for ADSI and ActiveDirectory. Been a long time and it's a pain in the ass because you have to do extensive error checking.
It might actually be easier to do this with .NET and wwDotnetBridge as the .NET apis are more fault tolerant and make capturing errors easier.
+++ Rick ---
We want to host a VFP app on the cloud and provide access with RDS (formerly Terminal Services) and RemoteApp.
It was suggested by Azure folks that we create a virtual LAN with RemoteApp users accessing files on a server.
Besides the cost and performance issues that Rick brought up, this adds the issue of how to manage ActiveDirectory users programmatically.
We are not very savvy in .NET and would prefer to do it from VFP. Anybody knows what options exist?
TIA,
Alex
We want to host a VFP app on the cloud and provide access with RDS (formerly Terminal Services) and RemoteApp.
It was suggested by Azure folks that we create a virtual LAN with RemoteApp users accessing files on a server.
Besides the cost and performance issues that Rick brought up, this adds the issue of how to manage ActiveDirectory users programmatically.
Here is some code that I use to check if the user is a member of "Labraintranet" group:
Local lcNTUserName, lcUserDomain, lcUserName, loNetwork, ccADS_NAME_INITTYPE_GC, ccADS_NAME_TYPE_NT4
Local ccADS_NAME_TYPE_1779, lcDN, loNameTrans, lNoAdccADS_NAME_INITTYPE_GC = 3
ccADS_NAME_TYPE_NT4 = 3
ccADS_NAME_TYPE_1779 = 1
lNoAd = .F.Odse = Getobject("LDAP://RootDse")
loNetwork = Createobject("WScript.Network")lcUserDomain = loNetwork.UserDomain
loNameTrans = Createobject("NameTranslate")
If Vartype(loNameTrans) <> "O"
lNoAd = .T.
Endif
* un = Users login name
Try
loNameTrans.Init( ccADS_NAME_INITTYPE_GC, "")
loNameTrans.Set(ccADS_NAME_TYPE_NT4, lcUserDomain + "\" + un)
lcDN = loNameTrans.Get(ccADS_NAME_TYPE_1779)
loAdUser = Getobject("LDAP://" + lcDN)
Catch To oException
ENDTRY
If Vartype(oException) = "O"
RETURN .f.
ENDIF
oException = null
Y=0
Do While .T.
Try
cMemberOf = loAdUser.Getex("memberOf")
If Not Empty(cMemberOf[1])
Exit
Endif
Catch To oException
Endtry
If Vartype(oException) = "O"
If oException.ErrorNo <> 0
This.seterror("AD not available")
Strtofile("Error occurred at: " + Transform(Datetime()) + CRLF +;
[ Error: ] + Str(oException.ErrorNo) + CRLF +;
[ LineNo: ] + Str(oException.Lineno) + CRLF +;
[ Message: ] + oException.Message + CRLF +;
[ Procedure: ] + oException.Procedure + CRLF +;
[ Details: ] + oException.Details + CRLF +;
[ RetryCount: ] + Str(Y) + CRLF +;
[ LineContents: ] + oException.LineContents + CRLF ;
, This.cappstartpath + "Errors.log",.T.)
lNoAd = .T.
Endif
Endif
Y=Y+1
If Y > 20
Exit
Endif
EnddoIf lNoAd
Return .F.
EndifLocal isMember
isMember = .F.
For Each odata In cMemberOf
If "Labraintranet"$odata
isMember = .T.
Exit
Endif
EndforIf isMember
Do something...
--
JS
Alex
We want to host a VFP app on the cloud and provide access with RDS (formerly Terminal Services) and RemoteApp.
It was suggested by Azure folks that we create a virtual LAN with RemoteApp users accessing files on a server.
Besides the cost and performance issues that Rick brought up, this adds the issue of how to manage ActiveDirectory users programmatically.
Here is some code that I use to check if the user is a member of "Labraintranet" group:
Local lcNTUserName, lcUserDomain, lcUserName, loNetwork, ccADS_NAME_INITTYPE_GC, ccADS_NAME_TYPE_NT4
Local ccADS_NAME_TYPE_1779, lcDN, loNameTrans, lNoAdccADS_NAME_INITTYPE_GC = 3
ccADS_NAME_TYPE_NT4 = 3
ccADS_NAME_TYPE_1779 = 1
lNoAd = .F.Odse = Getobject("LDAP://RootDse")
loNetwork = Createobject("WScript.Network")lcUserDomain = loNetwork.UserDomain
loNameTrans = Createobject("NameTranslate")
If Vartype(loNameTrans) <> "O"
lNoAd = .T.
Endif
* un = Users login name
Try
loNameTrans.Init( ccADS_NAME_INITTYPE_GC, "")
loNameTrans.Set(ccADS_NAME_TYPE_NT4, lcUserDomain + "\" + un)
lcDN = loNameTrans.Get(ccADS_NAME_TYPE_1779)
loAdUser = Getobject("LDAP://" + lcDN)
Catch To oException
ENDTRY
If Vartype(oException) = "O"
RETURN .f.
ENDIF
oException = null
Y=0
Do While .T.
Try
cMemberOf = loAdUser.Getex("memberOf")
If Not Empty(cMemberOf[1])
Exit
Endif
Catch To oException
Endtry
If Vartype(oException) = "O"
If oException.ErrorNo <> 0
This.seterror("AD not available")
Strtofile("Error occurred at: " + Transform(Datetime()) + CRLF +;
[ Error: ] + Str(oException.ErrorNo) + CRLF +;
[ LineNo: ] + Str(oException.Lineno) + CRLF +;
[ Message: ] + oException.Message + CRLF +;
[ Procedure: ] + oException.Procedure + CRLF +;
[ Details: ] + oException.Details + CRLF +;
[ RetryCount: ] + Str(Y) + CRLF +;
[ LineContents: ] + oException.LineContents + CRLF ;
, This.cappstartpath + "Errors.log",.T.)
lNoAd = .T.
Endif
Endif
Y=Y+1
If Y > 20
Exit
Endif
EnddoIf lNoAd
Return .F.
EndifLocal isMember
isMember = .F.
For Each odata In cMemberOf
If "Labraintranet"$odata
isMember = .T.
Exit
Endif
EndforIf isMember
Do something...