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

Notification

Icon
Error

Options
Go to last post Go to first unread
ditkar  
#1 Posted : Tuesday, January 6, 2015 11:23:13 AM(UTC)
ditkar


Rank: Advanced Member

Joined: 7/9/2014(UTC)
Posts: 84
Man
United States

Thanks: 8 times
I am working on creating reports for SC and finding it little difficult to do so. Especially, the HostName field in the Session.db. We have enabled LDAP with our SC 5.0 version. So the Display Name is getting stored in HostName field of Session table. Problem is I am few users who's First and Last name are exact match. Is there any way to store userID but use their Full Name where there is need to Display their names.
If not, do you have any suggestions to concatenate FullName with one of the parameter of LDAP like EmployeeID so that name + empid is saved in Session table. This way I can uniquely identify the session records.

Alexander  
#2 Posted : Tuesday, January 6, 2015 3:30:40 PM(UTC)
Alexander


Rank: Administration

Medals: Level 3: Shirt off your back! Received 25 Thanks!

Joined: 7/23/2013(UTC)
Posts: 716
Man
Location: Raleigh, NC

Was thanked: 66 time(s) in 63 post(s)
Hmm, you could perhaps concatenate EmployeeID onto the Display Name using something like what's done in this thread.
ScreenConnect Team
ditkar  
#3 Posted : Wednesday, January 7, 2015 11:02:38 AM(UTC)
ditkar


Rank: Advanced Member

Joined: 7/9/2014(UTC)
Posts: 84
Man
United States

Thanks: 8 times
Excuse my ignorance but the thread you mentioned talks about Two factor authentication. Not sure how will it help here?

Edited by user Wednesday, January 7, 2015 11:15:05 AM(UTC)  | Reason: Not specified

Alexander  
#4 Posted : Thursday, January 8, 2015 4:35:27 PM(UTC)
Alexander


Rank: Administration

Medals: Level 3: Shirt off your back! Received 25 Thanks!

Joined: 7/23/2013(UTC)
Posts: 716
Man
Location: Raleigh, NC

Was thanked: 66 time(s) in 63 post(s)
The solution there involved creating a custom membership provider, and something similar could perhaps be done here:

(This will add the UserName in parentheses after the UserDisplayName.)
Put a file with this in it into an App_Code directory under your install. Then where Elsinore.ScreenConnect.WindowsMembershipProvider is referenced in the web.config, add <add name="MyWindowsMembershipProvider" type="MyWindowsMembershipProvider" />
Code:
using System.Linq;
using System.Web.Security;
using Elsinore.ScreenConnect;

public class MyWindowsMembershipProvider : WindowsMembershipProvider
{
    public override MembershipUser GetUser(string userName, bool userIsOnline)
    {
        var baseUser = (DisplayNameMembershipUser)base.GetUser(userName, userIsOnline);

        if (baseUser == null)
            return null;

        return new DisplayNameMembershipUser(
            baseUser.ProviderName,
            baseUser.UserName,
            baseUser.ProviderUserKey,
            baseUser.Email,
            baseUser.PasswordQuestion,
            baseUser.Comment,
            baseUser.IsApproved,
            baseUser.IsLockedOut,
            baseUser.CreationDate,
            baseUser.LastLoginDate,
            baseUser.LastActivityDate,
            baseUser.LastPasswordChangedDate,
            baseUser.LastLockoutDate,
            baseUser.UserDisplayName + " (" + baseUser.UserName + ")"
        );
    }
}
ScreenConnect Team
ditkar  
#5 Posted : Friday, January 9, 2015 11:25:45 AM(UTC)
ditkar


Rank: Advanced Member

Joined: 7/9/2014(UTC)
Posts: 84
Man
United States

Thanks: 8 times
This tried per your instructions but the host name still shows the DisplayName only.
Alexander  
#6 Posted : Friday, January 9, 2015 4:04:27 PM(UTC)
Alexander


Rank: Administration

Medals: Level 3: Shirt off your back! Received 25 Thanks!

Joined: 7/23/2013(UTC)
Posts: 716
Man
Location: Raleigh, NC

Was thanked: 66 time(s) in 63 post(s)
Hmm, it worked when I tried it, though I don't know how similar our setups areā€¦ Oh yeah, you also have to switch to MyWindowsMembershipProvider in the Security tab.

Edited by user Friday, January 9, 2015 4:05:40 PM(UTC)  | Reason: Not specified

ScreenConnect Team
ditkar  
#7 Posted : Saturday, January 10, 2015 7:29:03 AM(UTC)
ditkar


Rank: Advanced Member

Joined: 7/9/2014(UTC)
Posts: 84
Man
United States

Thanks: 8 times
Quote:
Oh yeah, you also have to switch to MyWindowsMembershipProvider in the Security tab.


This worked beautifully on the development server which is in the domain. But how can we achieve the same for the server that is not in the domain and uses LDAP?

Edited by user Saturday, January 10, 2015 11:37:06 AM(UTC)  | Reason: Not specified

Alexander  
#8 Posted : Monday, January 12, 2015 3:08:28 PM(UTC)
Alexander


Rank: Administration

Medals: Level 3: Shirt off your back! Received 25 Thanks!

Joined: 7/23/2013(UTC)
Posts: 716
Man
Location: Raleigh, NC

Was thanked: 66 time(s) in 63 post(s)
Hmm, it might just be a question of putting LdapMembershipProvider instead of WindowsMembershipProvider.
ScreenConnect Team
ditkar  
#9 Posted : Tuesday, January 13, 2015 11:51:13 AM(UTC)
ditkar


Rank: Advanced Member

Joined: 7/9/2014(UTC)
Posts: 84
Man
United States

Thanks: 8 times
This perfectly worked. Now the Display Name shows up with the username on LDAP Membership.

To recap...

I added this to App_Code: MyLdapMembershipProvider.cs

using System.Linq;
using System.Web.Security;
using Elsinore.ScreenConnect;

public class MyLdapMembershipProvider : LdapMembershipProvider
{
public override MembershipUser GetUser(string userName, bool userIsOnline)
{
var baseUser = (DisplayNameMembershipUser)base.GetUser(userName, userIsOnline);

if (baseUser == null)
return null;

return new DisplayNameMembershipUser(
baseUser.ProviderName,
baseUser.UserName,
baseUser.ProviderUserKey,
baseUser.Email,
baseUser.PasswordQuestion,
baseUser.Comment,
baseUser.IsApproved,
baseUser.IsLockedOut,
baseUser.CreationDate,
baseUser.LastLoginDate,
baseUser.LastActivityDate,
baseUser.LastPasswordChangedDate,
baseUser.LastLockoutDate,
baseUser.UserDisplayName + " (" + baseUser.UserName.ToString().Replace("@abcinc.com","").Replace("@abcaid.com","") + ")"
);
}
}


Then I selected the "MyLdapMembershipProvider" under Security > User Source. I entered the essential information and saved. Logged out and logged back in... viola!!

Thank you!

Edited by user Saturday, March 25, 2017 1:18:05 PM(UTC)  | Reason: Not specified

Stefan  
#10 Posted : Friday, January 30, 2015 2:22:28 PM(UTC)
Stefan


Rank: Advanced Member

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 2/14/2013(UTC)
Posts: 66
Man
Germany
Location: Germany

Thanks: 16 times
Was thanked: 2 time(s) in 2 post(s)
And this worked for me using internal database:

I added this to App_Code directory: MyXmlMembershipProvider.cs

Code:
public class MyXmlMembershipProvider : XmlMembershipProvider
{
    public override MembershipUser GetUser(string userName, bool userIsOnline)
    {
        var baseUser = (DisplayNameMembershipUser)base.GetUser(userName, userIsOnline);

        if (baseUser == null)
            return null;

        return new DisplayNameMembershipUser(
            baseUser.ProviderName,
            baseUser.UserName,
            baseUser.ProviderUserKey,
            baseUser.Email,
            baseUser.PasswordQuestion,
            baseUser.Comment,
            baseUser.IsApproved,
            baseUser.IsLockedOut,
            baseUser.CreationDate,
            baseUser.LastLoginDate,
            baseUser.LastActivityDate,
            baseUser.LastPasswordChangedDate,
            baseUser.LastLockoutDate,
            baseUser.UserDisplayName + " (" + baseUser.UserName + ")"
        );
    }
}


Added MyXmlMembershipProvider to the web.config (copied the Elsinore.ScreenConnect.XmlMembershipProvider Lines) and choosed "MyXmlMembershipProvider" under Security > User Source.

Thanks a lot!
AchillesComplex  
#11 Posted : Thursday, January 14, 2016 6:14:50 PM(UTC)
AchillesComplex


Rank: Newbie

Joined: 1/7/2016(UTC)
Posts: 8

Hi All,

Just curious if these instructions still work in version 5.4.9849? We're using the Active Directory method and so far it's a no-go. As soon as I drop that MyWindowsMembershipProvider.cs file into the App_Code folder with the above contents the web server errors out. Changes to the web.config file afterwards have no effect as well as completely restarting the web service. Thanks for any assistance!
Alexander  
#12 Posted : Thursday, January 14, 2016 6:24:49 PM(UTC)
Alexander


Rank: Administration

Medals: Level 3: Shirt off your back! Received 25 Thanks!

Joined: 7/23/2013(UTC)
Posts: 716
Man
Location: Raleigh, NC

Was thanked: 66 time(s) in 63 post(s)
Might just be a matter of removing the "Elsinore" (using ScreenConnect; instead of using Elsinore.ScreenConnect;)
ScreenConnect Team
AchillesComplex  
#13 Posted : Thursday, January 14, 2016 6:42:09 PM(UTC)
AchillesComplex


Rank: Newbie

Joined: 1/7/2016(UTC)
Posts: 8

Beautiful! That's the change I needed! Thanks Alexander!
ditkar  
#14 Posted : Saturday, March 25, 2017 1:38:11 PM(UTC)
ditkar


Rank: Advanced Member

Joined: 7/9/2014(UTC)
Posts: 84
Man
United States

Thanks: 8 times
I upgraded to 6.1. and now the custom membership does not work. Here is the error:

Code:
Compiler Error Message: CS0246: The type or namespace name 'DisplayNameMembershipUser' could not be found (are you missing a using directive or an assembly reference?)

Source Error:


Line 7:      public override MembershipUser GetUser(string userName, bool userIsOnline)
Line 8:      {
Line 9:          var baseUser = (DisplayNameMembershipUser)base.GetUser(userName, userIsOnline);
Line 10:  
Line 11:         if (baseUser == null)



The code I implemented is below and it has worked till date.

Quote:
This perfectly worked. Now the Display Name shows up with the username on LDAP Membership.

To recap...

I added this to App_Code: MyLdapMembershipProvider.cs

using System.Linq;
using System.Web.Security;
using Elsinore.ScreenConnect;

public class MyLdapMembershipProvider : LdapMembershipProvider
{
public override MembershipUser GetUser(string userName, bool userIsOnline)
{
var baseUser = (DisplayNameMembershipUser)base.GetUser(userName, userIsOnline);

if (baseUser == null)
return null;

return new DisplayNameMembershipUser(
baseUser.ProviderName,
baseUser.UserName,
baseUser.ProviderUserKey,
baseUser.Email,
baseUser.PasswordQuestion,
baseUser.Comment,
baseUser.IsApproved,
baseUser.IsLockedOut,
baseUser.CreationDate,
baseUser.LastLoginDate,
baseUser.LastActivityDate,
baseUser.LastPasswordChangedDate,
baseUser.LastLockoutDate,
baseUser.UserDisplayName + " (" + baseUser.UserName.ToString().Replace("@abcinc.com","").Replace("@abcaid.com","") + ")"
);
}
}


Then I selected the "MyLdapMembershipProvider" under Security > User Source. I entered the essential information and saved. Logged out and logged back in... viola!!

Thank you!
Alexander  
#15 Posted : Monday, March 27, 2017 2:14:08 PM(UTC)
Alexander


Rank: Administration

Medals: Level 3: Shirt off your back! Received 25 Thanks!

Joined: 7/23/2013(UTC)
Posts: 716
Man
Location: Raleigh, NC

Was thanked: 66 time(s) in 63 post(s)
Ah, DisplayNameMembershipUser has been renamed to MembershipUserEx.
ScreenConnect Team
ditkar  
#16 Posted : Monday, March 27, 2017 2:25:28 PM(UTC)
ditkar


Rank: Advanced Member

Joined: 7/9/2014(UTC)
Posts: 84
Man
United States

Thanks: 8 times
Any idea how many arguments does it take? Any documentation for reference? If you see above I need to get user name.
Alexander  
#17 Posted : Monday, March 27, 2017 5:32:09 PM(UTC)
Alexander


Rank: Administration

Medals: Level 3: Shirt off your back! Received 25 Thanks!

Joined: 7/23/2013(UTC)
Posts: 716
Man
Location: Raleigh, NC

Was thanked: 66 time(s) in 63 post(s)
Oh yeah, the reason it was renamed was because PasswordExpirationDate was added; you'll just need to add baseUser.PasswordExpirationDate to the end of the constructor's argument list:
Code:
return new MembershipUserEx(
	baseUser.ProviderName,
	baseUser.UserName,
	baseUser.ProviderUserKey,
	baseUser.Email,
	baseUser.PasswordQuestion,
	baseUser.Comment,
	baseUser.IsApproved,
	baseUser.IsLockedOut,
	baseUser.CreationDate,
	baseUser.LastLoginDate,
	baseUser.LastActivityDate,
	baseUser.LastPasswordChangedDate,
	baseUser.LastLockoutDate,
	baseUser.UserDisplayName + " (" + baseUser.UserName.ToString().Replace("@abcinc.com","").Replace("@abcaid.com","") + ")",
	baseUser.PasswordExpirationDate
);

Edited by user Monday, March 27, 2017 5:33:09 PM(UTC)  | Reason: formatting

ScreenConnect Team
ditkar  
#18 Posted : Wednesday, March 29, 2017 7:42:07 AM(UTC)
ditkar


Rank: Advanced Member

Joined: 7/9/2014(UTC)
Posts: 84
Man
United States

Thanks: 8 times
Thank you. That worked.
AchillesComplex  
#19 Posted : Monday, October 30, 2017 5:01:39 PM(UTC)
AchillesComplex


Rank: Newbie

Joined: 1/7/2016(UTC)
Posts: 8


Hey I just tried doing the 6.2 to 6.4 upgrade and it appears the MembershipUserEx constructor parameters have changed again. Any way to find out what the new format is?
Conrad L  
#20 Posted : Monday, October 30, 2017 7:42:02 PM(UTC)
Conrad L


Rank: Administration

Joined: 7/17/2017(UTC)
Posts: 17

Thanks: 2 times
Was thanked: 7 time(s) in 6 post(s)
Try moving the display name in between the user name and the provider user key:

Code:

return new MembershipUserEx(
	baseUser.ProviderName,
	baseUser.UserName,
    baseUser.UserDisplayName + " (" + baseUser.UserName.ToString().Replace("@abcinc.com","").Replace("@abcaid.com","") + ")",
	baseUser.ProviderUserKey,
	baseUser.Email,
	baseUser.PasswordQuestion,
	baseUser.Comment,
	baseUser.IsApproved,
	baseUser.IsLockedOut,
	baseUser.CreationDate,
	baseUser.LastLoginDate,
	baseUser.LastActivityDate,
	baseUser.LastPasswordChangedDate,
	baseUser.LastLockoutDate,
	baseUser.PasswordExpirationDate
);
ScreenConnect Team
AchillesComplex  
#21 Posted : Monday, October 30, 2017 10:18:51 PM(UTC)
AchillesComplex


Rank: Newbie

Joined: 1/7/2016(UTC)
Posts: 8


Ok, I tried this in my lab environment and it looks like it's working. I'm going to try it on my production server soon and will report back the final result.
AchillesComplex  
#22 Posted : Friday, November 3, 2017 6:32:38 PM(UTC)
AchillesComplex


Rank: Newbie

Joined: 1/7/2016(UTC)
Posts: 8


Ok, I did this upgrade last night on our production box and it's working. Thanks for the assistance!
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.