Hallo zusammen
ich hab die Aufgabe, eine Webseite zu erstellen, die mich per RDP ActiveX Element auf einen ausgewählten Server verbindet. Nun habe ich irgendwie Probleme das Objekt für MsRdpClient zu erstellen. Im Beispiel von Microsoft wird die Methode Document.GetElementById verwendet. Nun hab ich Document irgendwie nicht zur Verfügung. Gibt es noch andere Möglichkeiten, dieses Object zu erstellen?
Ist vllt noch zu sagen, dass ich keine Ahnung von VB.Net habe und das mit den verschiedenen Namespaces nicht so ganz schnall. Hoffe jemand kann mir weiterhelfen.
Grüsse
Rascho
-------
Hi
I have the task of creating a website that connects me via RDP ActiveX element to a selected server. Now I have to somehow create problems for the object MsRdpClient. In the example of Microsoft document.getElementById method is used. Now I've somehow Document not available. Are there other ways to create this object?
Is to say one probably add that I have no idea of VB.Net and the various namespaces not quite seatbelt. Hope someone can help me.
regards
Rascho
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="ConnectVistaPool._Default" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/vbscript" language="vbscript" runat="server">
Dim VistaPool001(4) As String
Dim VistaPool002(4) As String
Dim VistaPool004(4) As String
Const L_FullScreenWarn1_Text = "Your current security settings do not allow automatically switching to fullscreen mode."
Const L_FullScreenWarn2_Text = "You can use ctrl-alt-pause to toggle your remote desktop session to fullscreen mode"
Const L_FullScreenTitle_Text = "Remote Desktop Web Connection "
Const L_ErrMsg_Text = "Error connecting to remote computer: "
Const L_ClientNotSupportedWarning_Text = "Remote Desktop 6.0 does not support CredSSP over TSWeb."
Const L_RemoteDesktopCaption_ErrorMessage = "Remote Desktop Connection"
Const L_InvalidServerName_ErrorMessage = "An invalid server name was specified."
Sub FuncConnect()
VistaPool001(0) = "w-001-209049"
VistaPool001(1) = "w-001-208803"
VistaPool001(2) = "w-001-209026"
VistaPool001(3) = "w-001-209228"
VistaPool001(4) = "w-001-208780"
VistaPool002(0) = "w-002-705072"
VistaPool002(1) = "w-002-705074"
VistaPool002(2) = "w-002-705081"
VistaPool002(3) = "w-002-705011"
VistaPool002(4) = "w-002-705012"
VistaPool004(0) = "w-004-705030"
VistaPool004(1) = "w-004-705031"
VistaPool004(2) = "w-004-705037"
VistaPool004(3) = "w-004-705061"
VistaPool004(4) = "w-004-705075"
Dim UserName As String
Dim UserOU As String
Dim ServerName As String
Dim Avaible As Boolean
Dim count As Integer = 0
UserName = txtUserName.Text
UserOU = UserName.Substring(2, 3)
Select Case UserOU
Case "001"
Do
Avaible = CheckAva(count, UserOU)
If count < 5 Then
count = count + 1
Else
MsgBox("No Host in OU 001 avaible")
Exit Do
End If
Loop Until Avaible = True
ServerName = VistaPool001(count - 1)
MsRdpConnect(ServerName)
Case "002"
Do
Avaible = CheckAva(count, UserOU)
If count < 5 Then
count = count + 1
Else
MsgBox("No Host in OU 002 avaible")
Exit Do
End If
Loop Until Avaible = True
ServerName = VistaPool002(count - 1)
MsRdpConnect(ServerName)
Case "004"
Do
Avaible = CheckAva(count, UserOU)
If count < 5 Then
count = count + 1
Else
MsgBox("No Host in OU 004 avaible")
Exit Do
End If
Loop Until Avaible = True
ServerName = VistaPool004(count - 1)
MsRdpConnect(ServerName)
Case Else
MsgBox("No valid user", MsgBoxStyle.Information, "Access Violation")
End Select
End Sub
Function CheckAva(ByVal HostNumber As Integer, ByVal OrgUnit As Integer)
Dim HostName As String
Dim strWMIQuery As Object
Dim objSWbemServices As Object
Dim objSWbemLocator As Object
Select Case OrgUnit
Case "001"
HostName = VistaPool001(HostNumber)
Case "002"
HostName = VistaPool002(HostNumber)
Case "004"
HostName = VistaPool004(HostNumber)
End Select
objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
objSWbemServices = objSWbemLocator.ConnectServer(HostName, "root\cimv2", "xxxxxxx", "xxxxxxx")
objSWbemServices.Security_.ImpersonationLevel = 3
strWMIQuery = "Select * from Win32_Process where name like '" & "explorer.exe" & "'"
MsgBox(strWMIQuery)
If objSWbemServices.ExecQuery(strWMIQuery).Count > 0 Then
CheckAva = False
Else
CheckAva = True
End If
End Function
Sub MsRdpConnect(ByVal HostName As String)
Dim Control As Object
Control = Document.getElementById("MsRdpClient")
HostName = Trim(HostName)
Dim MsRdpClient
MsRdpClient.server = HostName
MsRdpClient.FullScreen = True
MsRdpClient.AdvancedSettings5.AuthenticationLevel = 2
MsRdpClient.AdvancedSettings7.EnableCredSspSupport = True
MsRdpClient.AdvancedSettings2.RedirectDrives = False
MsRdpClient.AdvancedSettings2.RedirectPrinters = False
MsRdpClient.AdvancedSettings2.RedirectPrinters = False
MsRdpClient.AdvancedSettings2.RedirectClipboard = True
MsRdpClient.AdvancedSettings2.RedirectSmartCards = False
MsRdpClient.AdvancedSettings2.RedirectPorts = False
MsRdpClient.FullScreenTitle = L_FullScreenTitle_Text & "(" & HostName & ")"
MsRdpClient.TransportSettings.GatewayUsageMethod = 1
MsRdpClient.TransportSettings.GatewayCredsSource = 0
MsRdpClient.TransportSettings.GatewayProfileUsageMethod = 1
MsRdpClient.TransportSettings.GatewayUserSelectedCredsSource = 0
MsRdpClient.TransportSettings.GatewayHostname = "rgw.hcweb.ch"
MsRdpClient.Connect()
End Sub
</script>
<head runat="server">
<meta content="text/html; charset=windows-1252" http-equiv="Content-Type" />
<meta name="GENERATOR" content="MSHTML 8.00.7600.16625" />
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td><asp:Button onclick="FuncConnect" runat="server" Text="Connect"/></td>
<td><asp:Label ID="lblUserName" runat="server" /></td>
<td><asp:TextBox ID="txtUserName" runat="server" /></td>
<td><asp:TextBox ID="txtServerName" runat="server" /></td>
</tr>
</table>
<div style="display: none" id="connectArea">
<table>
<tbody>
<tr>
<td>
<object
id="MsRdpClient"
language="vbscript"
classid="CLSID:4eb89ff4-7f78-4a0f-8b8d-2bf02e94e4b2"
width="800"
height="600">
</object>
</td>
</tr>
<tr>
<td>
<br>
<font id="srvfontname" color="#000000" size="1" face="Verdana, Arial, Helvetica">
<div style="display: none" id="connectDisplay">
<id id="loggedinsrv">Connected to </id>
<span id="srvNameField"></span>
<br>
</br></div>
</font>
</br></td>
</tr>
</tbody>
</table>
</div>
</form>
</body>
</html>
</div>