Here is a page that you can put in your ScreenConnect directory that will redirect to launch the host:
Code:<%@ WebHandler Language="C#" Class="LaunchHostClient" %>
using System;
using System.Web;
using System.Collections.Generic;
using System.Linq;
using System.Configuration;
using Elsinore.ScreenConnect;
public class LaunchHostClient : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
var sessionTag = context.Request.QueryString["Tag"];
var relayUri = ServerExtensions.GetRelayUri(ConfigurationManager.AppSettings, HttpContext.Current.Request.Url, true, true);
using (var sessionManager = ServerExtensions.SessionManagerChannelFactory.CreateChannel())
{
var sessionSummary = sessionManager.GetSessionSummaries("All Machines", new Dictionary<string, string>(), null).First(ss => string.Equals(ss.Tag, sessionTag, StringComparison.InvariantCultureIgnoreCase));
var clp = new ClientLaunchParameters();
clp.Host = relayUri.Host;
clp.Port = relayUri.Port;
clp.SessionID = sessionSummary.SessionID;
clp.ProcessType = ProcessType.Host;
clp.EncryptionKey = ServerCryptoManager.Instance.PublicKey;
clp.AccessToken = ServerCryptoManager.Instance.GetAccessToken(clp.SessionID, clp.ProcessType);
clp.ApplicationTitle = Resources.Default.Client_ApplicationTitle;
clp.SessionTitle = sessionSummary.Tag;
var url = "Bin/Elsinore.ScreenConnect.HostClient.application" + ClientLaunchParameters.ToQueryString(clp);
context.Response.AppendHeader("Refresh", "0; URL=" + url);
// does the right thing with the browser, but reports the wrong query string
//context.Response.Redirect(url);
}
}
public bool IsReusable { get { return false; } }
}
It takes a parameter "Tag" and will connect to the session with that tag.
From the command line:
Code:"iexplore.exe" "http://localhost:8040/LaunchHostClient.ashx?Tag=DURHAM"
It works, but leaves up the IE window.
This method gets never uses IE and should work, but doesn't like any redirects:
Code:rundll32 dfshim.dll,ShOpenVerbApplication "http://localhost:8040/LaunchHostClient.ashx?Tag=DURHAM"
Also uncommenting the redirect line up in the code should work and use IE, but then the wrong activation URI is reported to the clickonce app. So we have to do a client redirect (appendheader) rather than a server redirect (response.redirect). The problem here is that it leaves up the IE window.
Really the optimal solution would be for you to have a script file that did a wget of the LaunchHostClient.ashx, then ran the results with rundll32.