MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

LoginRPX Information (Closed) (Mono Support )

Viewed 12473 time(s), 4 post(s) 4/21/2012 4:29:25 AMby David
David

David

4/21/2012 4:30:09 AM
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 .
This content has not been rated yet. 
174 Reputation 22 Total posts
khorvat

khorvat

4/21/2012 7:23:32 AM
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
This content has not been rated yet. 
15993 Reputation 2214 Total posts
Jeremy

Jeremy

4/21/2012 7:50:20 AM
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.
This content has not been rated yet. 
322 Reputation 36 Total posts
David

David

4/23/2012 5:57:00 AM
This puts me in the right direction. Thank you.
This content has not been rated yet. 
174 Reputation 22 Total posts