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 (Zatvorena) (Mono Support )

13362 put(a) pogledan, 4 odgovor(a) 21.4.2012. 4:29:25Kreirao(la) David
David

David

21.4.2012. 4:30:09
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 .
Ovaj sadržaj još nije ocijenjen. 
174 Reputacija 22 Ukupno objava
khorvat

khorvat

21.4.2012. 7:23:32
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
Ovaj sadržaj još nije ocijenjen. 
15993 Reputacija 2214 Ukupno objava
Jeremy

Jeremy

21.4.2012. 7:50:20
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.
Ovaj sadržaj još nije ocijenjen. 
322 Reputacija 36 Ukupno objava
David

David

23.4.2012. 5:57:00
This puts me in the right direction. Thank you.
Ovaj sadržaj još nije ocijenjen. 
174 Reputacija 22 Ukupno objava