Mono Support LoginRPX Information (Closed)

Viewed 13251 time(s), 4 post(s), 4/21/2012 4:29:25 AM - by David
4/21/2012 4:30:09 AM
174 Reputation 22 Total posts

When attaching to the event "Authenticated" in LoginRPX.ascx, is it possible at that point to get the information provided such as the users email address, name or what authentication method was just used? This control must get that information because it creates the user account, right?

I wish to do something once the user is authenticated but I must have those pieces of information .

1
4/21/2012 7:23:32 AM
15993 Reputation 2214 Total posts

Hi,

you can get that information in the event arguments from the Authenticated event. It will provide you with MembershipUser object where you can get username, e-mail etc. Note that you can't get the authentication type because it is a security issue, the whole point of the RPX is not to know user authentication data or profile information. 

Let me know if you need anything else.

Regards

2
4/21/2012 7:50:20 AM
322 Reputation 36 Total posts

Are you attaching to the event just to get the information? If you are using the default membership provider, which looks like this in the web.config:

<membership defaultProvider="AspNetSqlMembershipProvider" hashAlgorithmType="SHA1">
      <providers>
        <remove name="AspNetSqlMembershipProvider" />
        <add connectionStringName="LocalSqlServer" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="MonoX" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" name="AspNetSqlMembershipProvider" type="MonoSoftware.MonoX.MonoXMembershipProvider, MonoX" />
      </providers>
    </membership>

Then you can access the information without having to attach to an event. Following is some example code to show how this may work.

using MonoSoftware.MonoX.Utilities;
 
using System.Web.Security;
 
  
 
public partial class SomeClass : SomeOtherClass
 
{
 
    protected string Email { get; set; }
 
    protected string ProviderName { get; set; }
 
    protected string Name { get; set; }
 
    protected string UserName { get; set; }
 
    protected string IsAuthenticated { get; set; }
 
    protected string UserProfile { get; set; }
 
  
 
    protected void Page_Load(object sender, EventArgs e)
 
    {
 
      var user = Membership.GetUser();
 
      Email = Membership.GetUser().Email;
 
      ProviderName = Membership.GetUser().ProviderName;
 
      var UserGuid = SecurityUtility.GetUserId();
 
      IsAuthenticated = SecurityUtility.IsAuthenticated().ToString();
 
      UserName = Membership.GetUser().UserName;
 
      var UserProfile = SecurityUtility.GetUserProfile();
 
      }
 
}


You may use the data as you need in the code behind or in the aspx / ascx pages.

By "name" are you referring to the username or actual name of a person? If you want the actual name, then you probably need to implement some profile information for users.Hope that helps.

3
4/23/2012 5:57:00 AM
174 Reputation 22 Total posts

This puts me in the right direction. Thank you.

4
This is a demo site for MonoX. Please visit Mono Software for more info.