logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Tmc1  
#1 Posted : Tuesday, August 29, 2017 9:55:33 PM(UTC)
Tmc1


Rank: Guest

Joined: 8/29/2017(UTC)
Posts: 2

We are currently using v2.5 Screen Connect (formerly Elsinore) and (oh long ago) made a Windows support client that would create a http post and send to a ashx web handler to create the session and return the session values to execute the local (bundled) ScreenConnect guest Client. We are attempting to do the same in v6.3 and it appears things have gotten a bit more complicated. The v2.5 code to create the session (server-side) is below. I am hoping for some assistance in "translating" this to version 6. With the addition of Extensions and all of the other "new" integration possibilities, I cannot seem to find a "modern" rendition of this! Thanks for any advice in advance!

<%@ WebHandler Language="VB" Class="CreateSession" %>

Imports System
Imports System.Web

public class CreateSession
Implements IHttpHandler

Public Sub ProcessRequest(ByVal context As HttpContext) _
Implements IHttpHandler.ProcessRequest

Dim sCode as String = Context.Request("Code")


Dim objSessionMgr As Elsinore.ScreenConnect.ISessionManagerChannel _
= Elsinore.ScreenConnect.ServerExtensions.SessionManagerChannelFactory.CreateChannel

Dim objSession As Elsinore.ScreenConnect.Session

Dim uidSession As Nullable(Of Guid) = objSessionMgr.GetSessionID(Elsinore.ScreenConnect.InvitationType.Code, sCode)

If uidSession.HasValue Then objSession = objSessionMgr.GetSession(uidSession)

If objSession Is Nothing Then

objSession = objSessionMgr.CreateSession(Elsinore.ScreenConnect.InvitationType.Code, sCode, "Name")
uidSession = objSession.SessionID
Else

objSessionMgr.TransferSession(objSession.SessionID, "Name")

End If
'\\ Return the following 5 pipe-separated values:
'\\ Session Code, SessionID (UID), Encryption Key, Session Title, Session Host
Context.Response.Write(sCode & _
"|" & objSession.SessionID.ToString & _
"|" & Convert.ToBase64String(objSession.EncryptionKey) & _
"| Header Name" & _
"|" & objSession.Host)
End Sub


Public ReadOnly Property IsReusable() As Boolean _
Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
End Class

Edited by user Tuesday, August 29, 2017 9:56:29 PM(UTC)  | Reason: Not specified

Tmc1  
#2 Posted : Wednesday, August 30, 2017 12:03:14 AM(UTC)
Tmc1


Rank: Guest

Joined: 8/29/2017(UTC)
Posts: 2

OK - I've gotten somewhere - sort of but not really.

Using the Extensions, I've downloaded and installed the Extension Developer; then Created an Extension form Template (now available after installation of the Extension Developer) using "Integration Sample" as the Template cloned.

All good, but when attempting to connect to it (using either get or post to http://%URL%/App_Extensions/%UID%/Service.ashx/FindOrCreateSession/Test1/SessionCode) as the sample codebase provides, I get a 500 error. Any ideas or help on this?

Calling code from Client Application (tried with and without the credentials)

Dim request As WebRequest = WebRequest.Create("http://" & URLOrIPAddress & "/App_Extensions/" & UID & "Service.ashx/FindOrCreateSession/Test1/SessionCode")
request.Method = "GET"

Dim credC As New CredentialCache
credC.Add(request.RequestUri, "Basic", New NetworkCredential("UserAllowed", "Password for User"))
request.Credentials = credC

' Get the response from the Request Object
Dim response As WebResponse = request.GetResponse()

' Get the stream (through a stream reader) containing content returned by the server.
Dim dsReturn As Stream = response.GetResponseStream()
Dim reader As New StreamReader(dsReturn)
Dim responseFromServer As String = reader.ReadToEnd()
Scott  
#3 Posted : Wednesday, August 30, 2017 11:22:24 AM(UTC)
Scott


Rank: Administration

Medals: Level 4: Wise Old Owl! Received 100 Thanks!

Joined: 3/28/2014(UTC)
Posts: 2,468
United States

Thanks: 3 times
Was thanked: 304 time(s) in 261 post(s)
As of ~6.0ish we no longer accept parameters within GET requests for security reasons.

Instead, try POSTing your request with a payload containing the SessionCode.
ScreenConnect Team
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.