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

Notification

Icon
Error

Options
Go to last post Go to first unread
CyberDK  
#1 Posted : Monday, January 8, 2018 1:48:54 PM(UTC)
CyberDK


Rank: Guest

Joined: 1/8/2018(UTC)
Posts: 4
Denmark
Location: Copenhagen

Hello,

Hope someone can help us.

Our machines are named with an unique name on our SC servers based on random characters and not their hostname, but the problem is that we would like to have the hostname shown at the titel bar instead of the unique number.

Right we are using 'App_Extensions/***/Service.ashx/GetLaunchUrlFromName' is it possible to provide it with an argument so the titlebar changes to the our branding ++ hostname?

See picture hope it makes sense.

[img=https://imgur.com/a/0ASZx]SC titlebar[/img]

javascript:__doPostBack('forum$ctl03$PostReply','')
Scott  
#2 Posted : Monday, January 8, 2018 2:02:54 PM(UTC)
Scott


Rank: Administration

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

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

Thanks: 3 times
Was thanked: 338 time(s) in 292 post(s)
So there's potentially two ways to do this. By default the Host client just displays the Session's Name + Client so if you want that to show something different yet dynamic, just change each session's name to the desired value for that machine.

Secondly, depending upon how your 'GetLaunchUrlFromName' method is defined, you can likely just change the name there. Can you post the code that method is using?
ScreenConnect Team
CyberDK  
#3 Posted : Wednesday, January 10, 2018 12:13:43 PM(UTC)
CyberDK


Rank: Guest

Joined: 1/8/2018(UTC)
Posts: 4
Denmark
Location: Copenhagen

Here is our code, "device_id" is our unique backend naming of our clients devices, we can't change this part because multiple devices have the same name.
Therefore we would like to change the title bar naming so instead of showing "device_id" it would actually show a value that we provide e.g. hostname.

We was able to do thise in earlier version of SC where the URL that was used had the function 'LaunchHostClient.ashx' and the argument "Title"

"LaunchHostClient.ashx?Consent=true&User=Nikolaj&Tag=3e9b552aaa39de4856991cb189ec7676f8811817&Title=SrvKoege"


def get_screenconnect_url(ssl_sn, device_id, consent)
sc_user = consent ? "Support" : "Support."
# encode basic authorization
basic_auth = Base64.encode64("#{sc_user}:#{Rails.application.secrets.sc_password}")

url = "http://#{ssl_sn}.example.com/App_Extensions/f33b8d36-6447-4497-97bc-576ada84a119/Service.ashx/GetLaunchUrlFromName"
headers = {
'Authorization' => "Basic #{basic_auth}",
'Content-Type' => 'application/json'
}
# return url after decode special symbols
JSON.load(RestClient.post url, ActiveSupport::JSON.encode([device_id]), headers)
end

Edited by user Thursday, January 11, 2018 8:14:10 AM(UTC)  | Reason: Not specified

CyberDK  
#4 Posted : Friday, January 19, 2018 9:38:09 AM(UTC)
CyberDK


Rank: Guest

Joined: 1/8/2018(UTC)
Posts: 4
Denmark
Location: Copenhagen

Originally Posted by: Scott Go to Quoted Post
So there's potentially two ways to do this. By default the Host client just displays the Session's Name + Client so if you want that to show something different yet dynamic, just change each session's name to the desired value for that machine.

Secondly, depending upon how your 'GetLaunchUrlFromName' method is defined, you can likely just change the name there. Can you post the code that method is using?



Hi Scott,

Do you have any input to my last comment?

//Claus

Scott  
#5 Posted : Wednesday, February 7, 2018 3:30:51 PM(UTC)
Scott


Rank: Administration

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

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

Thanks: 3 times
Was thanked: 338 time(s) in 292 post(s)
I was asking about the GetLaunchUrlFromName method that's being implemented within an Extension, as shown:
App_Extensions/f33b8d36-6447-4497-97bc-576ada84a119/Service.ashx/GetLaunchUrlFromName

What does that method look like? Did you write it?
ScreenConnect Team
CyberDK  
#6 Posted : Wednesday, February 7, 2018 3:57:23 PM(UTC)
CyberDK


Rank: Guest

Joined: 1/8/2018(UTC)
Posts: 4
Denmark
Location: Copenhagen

Originally Posted by: Scott Go to Quoted Post
I was asking about the GetLaunchUrlFromName method that's being implemented within an Extension, as shown:
App_Extensions/f33b8d36-6447-4497-97bc-576ada84a119/Service.ashx/GetLaunchUrlFromName

What does that method look like? Did you write it?



Not sure what you are asking me about, the code posted above is our system calling the GetLaunchUrlFromName function, with those two arguments "[device_id]), headers"

But no we havn't wrote the function 'GetLaunchUrlFromName'-
But the old version of SC had a function called LaunchHostClient.ashx where the title bar naming could be set.
This is something we would like in the function 'GetLaunchUrlFromName'

We have around 7000+ machines connected to our SC servers where multiple machines have the same hostname, so we are not able to change the session_id so it match the machines hostname.

Edited by user Wednesday, February 7, 2018 4:03:29 PM(UTC)  | Reason: Not specified

Scott  
#7 Posted : Monday, March 12, 2018 11:45:12 AM(UTC)
Scott


Rank: Administration

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

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

Thanks: 3 times
Was thanked: 338 time(s) in 292 post(s)
So after some research that Extension is from here.

That particular method appears as:
Code:

public string GetLaunchUrlFromName(string sessionName)
	{
        var permissionEntries = Permissions.GetEntriesForUser();
        Permissions.AssertPermission(new PermissionRequest(), true);

        var sessionFilter = ServerExtensions.GetExpression("Name", "=", sessionName);
        var relayUri = ServerExtensions.GetRelayUri(ConfigurationManager.AppSettings, HttpContext.Current.Request.Url, true, true);
        var userDisplayName = FormsAuthenticationModule.GetUserDisplayNameWithFallback(HttpContext.Current.User);
        var variables = ServerExtensions.GetStandardVariables((string)userDisplayName);
        var handlerUrl = new Uri(HttpContext.Current.Request.Url, HttpRuntime.AppDomainAppVirtualPath) + WebConfigurationManager.GetHandlerPath(typeof(ClickOnceDirectHandler)).ReplaceFirst("*", WebResources.GetString("FileDownload.BaseName"));

        return
            (from session in SessionManagerPool.Demux.GetSessions(sessionFilter)
             from groupContainingSession in SessionManagerPool.Demux.GetSessionGroupsContainingSession(session.SessionID, variables)
             where Permissions.HasPermission(new SessionPermissionRequest { Name = PermissionInfo.ViewSessionGroupPermission, SessionType = session.SessionType, SessionGroupName = groupContainingSession }, permissionEntries)
             let sessionPermissions = PermissionInfo.GetSessionPermissions(permissionEntries, session.SessionType, groupContainingSession, session.Host == userDisplayName)
             select new ClientLaunchParameters
             {
                 Host = relayUri.Host,
                 Port = relayUri.Port,
                 EncryptionKey = ServerCryptoManager.Instance.PublicKey,
                 SessionType = session.SessionType,
                 SessionID = session.SessionID,
                 ProcessType = ProcessType.Host,
                 SessionTitle = session.Name,
                 AccessToken = ServerCryptoManager.Instance.GetAccessToken(session.SessionID, ProcessType.Host, userDisplayName, sessionPermissions, default(DateTime)),
             })
            .FirstOrDefault()
            .SafeNav(clp => handlerUrl + ClientLaunchParameters.ToQueryString(clp))
            .Else(default(string));
	}


By adding a 'customTitle' string parameter and modifying the SessionTitle creation value you can append values to the application title when launched via this method. These changes would look like:
Code:

public string GetLaunchUrlFromName(string sessionName, string customTitle)
{
	var permissionEntries = Permissions.GetEntriesForUser();
	Permissions.AssertPermission(new PermissionRequest(), true);

	var sessionFilter = ServerExtensions.GetExpression("Name", "=", sessionName);
	var relayUri = ServerExtensions.GetRelayUri(ConfigurationManager.AppSettings, HttpContext.Current.Request.Url, true, true);
	var userDisplayName = FormsAuthenticationModule.GetUserDisplayNameWithFallback(HttpContext.Current.User);
	var variables = ServerExtensions.GetStandardVariables((string)userDisplayName);
	var handlerUrl = new Uri(HttpContext.Current.Request.Url, HttpRuntime.AppDomainAppVirtualPath) + WebConfigurationManager.GetHandlerPath(typeof(ClickOnceDirectHandler)).ReplaceFirst("*", WebResources.GetString("FileDownload.BaseName"));

	return
		(from session in SessionManagerPool.Demux.GetSessions(sessionFilter)
		 from groupContainingSession in SessionManagerPool.Demux.GetSessionGroupsContainingSession(session.SessionID, variables)
		 where Permissions.HasPermission(new SessionPermissionRequest { Name = PermissionInfo.ViewSessionGroupPermission, SessionType = session.SessionType, SessionGroupName = groupContainingSession }, permissionEntries)
		 let sessionPermissions = PermissionInfo.GetSessionPermissions(permissionEntries, session.SessionType, groupContainingSession, session.Host == userDisplayName)
		 select new ClientLaunchParameters
		 {
			 Host = relayUri.Host,
			 Port = relayUri.Port,
			 EncryptionKey = ServerCryptoManager.Instance.PublicKey,
			 SessionType = session.SessionType,
			 SessionID = session.SessionID,
			 ProcessType = ProcessType.Host,
			 SessionTitle = customTitle + " " + session.Name,
			 AccessToken = ServerCryptoManager.Instance.GetAccessToken(session.SessionID, ProcessType.Host, userDisplayName, sessionPermissions, default(DateTime)),
		 })
		.FirstOrDefault()
		.SafeNav(clp => handlerUrl + ClientLaunchParameters.ToQueryString(clp))
		.Else(default(string));
}


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.