Extending MembershipUser

Discussion in 'ASP .Net' started by Mark Olbert, Jan 10, 2006.

  1. Mark Olbert

    Mark Olbert Guest

    I'm writing a custom MembershipProvider which uses a custom class derived from MembershipUser (basically, the derived class adds a
    field to the MembershipUser base class).

    When I try to configure my website using the ASP.NET Configuration tool, and go to the Security page, I get the following error:

    Could not load type 'OMLMembershipUser' from assembly 'App_Code.olsckwwk, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

    Yet OMLMembershipUser is defined in a file in the App_Code directory.

    Any idea what's causing this problem?

    - Mark
    Mark Olbert, Jan 10, 2006
    #1
    1. Advertising

  2. Hi Mark,

    Welcome to ASPNET newsgroup.
    As for the custom membership provider problem, from the description, I
    think it is likely something not configured correctly for your custom
    membership provider since the exception occurs at intialize time which is
    trying to load the membership provider class... Would you provide your
    class's declaration in source file and how you config it in web.cofig to us
    so that we can have a look?

    Thanks,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    --------------------
    | NNTP-Posting-Date: Mon, 09 Jan 2006 19:21:53 -0600
    | From: Mark Olbert <>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | Subject: Extending MembershipUser
    | Date: Mon, 09 Jan 2006 17:21:53 -0800
    | Organization: Olbert & McHugh, LLC
    | Reply-To:
    | Message-ID: <>
    | X-Newsreader: Forte Agent 3.1/32.783
    | MIME-Version: 1.0
    | Content-Type: text/plain; charset=us-ascii
    | Content-Transfer-Encoding: 7bit
    | Lines: 12
    | X-Trace:
    sv3-pHkiWfXx9hK+ply/Z1rCvgZernhuelgR8jNGdxGt5g0/8W4JAce6GyzXXI890EFaCWQZ7/7D
    /DzpULD!dQUwdGqA7y+HXdUai+Amk4BcSTGrsILoW58MCoHbXlWIuE0aaf/Ho9mwwSAboJGMq1CB
    jg==
    | X-Complaints-To:
    | X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
    | X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
    | X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
    complaint properly
    | X-Postfilter: 1.3.32
    | Path:
    TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
    ne.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.gigan
    ews.com!local01.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail
    | Xref: TK2MSFTNGXA02.phx.gbl
    microsoft.public.dotnet.framework.aspnet:369665
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    |
    | I'm writing a custom MembershipProvider which uses a custom class derived
    from MembershipUser (basically, the derived class adds a
    | field to the MembershipUser base class).
    |
    | When I try to configure my website using the ASP.NET Configuration tool,
    and go to the Security page, I get the following error:
    |
    | Could not load type 'OMLMembershipUser' from assembly 'App_Code.olsckwwk,
    Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
    |
    | Yet OMLMembershipUser is defined in a file in the App_Code directory.
    |
    | Any idea what's causing this problem?
    |
    | - Mark
    |
    Steven Cheng[MSFT], Jan 10, 2006
    #2
    1. Advertising

  3. Mark Olbert

    Mark Olbert Guest

    I don't think so (at least, it gets through the first part of creating a user, and actually adds the new user to the underlying
    SqlServer2005 datastore).

    BTW, is there any way to attach to the ASPNET Configuration process so that I can "watch" it in the debugger?

    Here's the source code:

    Membership Provider
    ===============
    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Configuration;
    using System.Text;
    using System.Web;
    using System.Web.Configuration;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;

    /// <summary>
    /// Summary description for membership
    /// </summary>
    public class OMLMembershipProvider : MembershipProvider
    {
    private membershipTableAdapters.bd_userTableAdapter ta;

    public override void Initialize( string name, System.Collections.Specialized.NameValueCollection config )
    {
    base.Initialize(name, config);

    ta = new membershipTableAdapters.bd_userTableAdapter();

    string env = WebConfigurationManager.AppSettings["environment"];
    ta.Connection.ConnectionString = WebConfigurationManager.ConnectionStrings[env].ConnectionString;
    }

    private string TransformPassword( string toTransform )
    {
    byte[] clearText = Encoding.UTF8.GetBytes(toTransform);
    byte[] encryptedText = EncryptPassword(clearText);

    return Convert.ToBase64String(encryptedText);
    }

    public override string ApplicationName
    {
    get
    {
    return "OMLMembershipProvider";
    }

    set
    {
    throw new Exception("The method or operation is not implemented.");
    }
    }

    public override bool EnablePasswordReset
    {
    get { return true; }
    }

    public override bool EnablePasswordRetrieval
    {
    get { return false; }
    }

    public override bool RequiresQuestionAndAnswer
    {
    get { return false; }
    }

    public override int MaxInvalidPasswordAttempts
    {
    get { return Int32.MaxValue; }
    }

    public override int PasswordAttemptWindow
    {
    get { return 10; }
    }

    public override bool RequiresUniqueEmail
    {
    get { return true; }
    }

    public override MembershipPasswordFormat PasswordFormat
    {
    get { return MembershipPasswordFormat.Encrypted; }
    }

    public override int MinRequiredPasswordLength
    {
    get { return 1; }
    }

    public override int MinRequiredNonAlphanumericCharacters
    {
    get { return 0; }
    }

    public override string PasswordStrengthRegularExpression
    {
    get { return String.Empty; }
    }

    public override bool ChangePassword( string username, string oldPassword, string newPassword )
    {
    membership.bd_userDataTable curDT = ta.GetDataByUserID(username.ToLower());
    if( (curDT == null) || (curDT.Count != 1) ) return false;

    if( curDT[0].password != TransformPassword(oldPassword.ToLower()) ) return false;

    curDT[0].password = TransformPassword(newPassword.ToLower());
    ta.Update(curDT[0]);

    return true;
    }

    public override bool ChangePasswordQuestionAndAnswer( string username, string password, string newPasswordQuestion, string
    newPasswordAnswer )
    {
    return true;
    }

    public override MembershipUser CreateUser( string username, string password, string email, string passwordQuestion, string
    passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status )
    {
    OnValidatingPassword(new ValidatePasswordEventArgs(username, password, true));

    if( ( username == null ) || ( username == String.Empty ) )
    {
    status = MembershipCreateStatus.InvalidUserName;
    return null;
    }

    if( ( password == null ) || ( password == String.Empty ) )
    {
    status = MembershipCreateStatus.InvalidPassword;
    return null;
    }

    if( ( email == null ) || ( email == String.Empty ) )
    {
    status = MembershipCreateStatus.InvalidEmail;
    return null;
    }

    username = username.ToLower();

    object numMatch = ta.NumMatchingUserID(username);
    if( (int) numMatch != 0 )
    {
    status = MembershipCreateStatus.DuplicateUserName;
    return null;
    }

    numMatch = ta.NumMatchingEmail(email.ToLower());
    if( (int) numMatch != 0 )
    {
    status = MembershipCreateStatus.DuplicateEmail;
    return null;
    }

    membership.bd_userDataTable curDT = ta.GetData();

    membership.bd_userRow curRow = curDT.Newbd_userRow();

    curRow.user_id = username;
    curRow.password = TransformPassword(password.ToLower());
    curRow.email = email.ToLower();
    curRow.flags = 0;
    curRow.moniker = String.Empty;

    curDT.Addbd_userRow(curRow);

    ta.Update(curRow);

    MembershipUser retVal = new MembershipUser("OMLMembershipProvider", username, -9, email,
    String.Empty, "Comment!", true, false, DateTime.Now, DateTime.MinValue, DateTime.MinValue,
    DateTime.MinValue, DateTime.MaxValue);

    status = MembershipCreateStatus.Success;

    return retVal;
    }

    public override string GetPassword( string username, string answer )
    {
    throw new Exception("The method or operation is not implemented.");
    }

    public override string ResetPassword( string username, string answer )
    {
    throw new Exception("The method or operation is not implemented.");
    }

    public override void UpdateUser( MembershipUser user )
    {
    membership.bd_userDataTable curDT = ta.GetDataByUserID(user.UserName.ToLower());
    if( (curDT == null) || (curDT.Count != 1) ) return;

    curDT[0].email = user.Email;

    ta.Update(curDT[0]);
    }

    public override bool ValidateUser( string username, string password )
    {
    membership.bd_userDataTable curDT = ta.GetDataByUserID(username.ToLower());
    if( ( curDT == null ) || ( curDT.Count != 1 ) ) return false;

    return ( curDT[0].password == TransformPassword(password) );
    }

    public override bool UnlockUser( string userName )
    {
    return true;
    }

    public override MembershipUser GetUser( string username, bool userIsOnline )
    {
    username = username.ToLower();

    membership.bd_userDataTable curDT = ta.GetDataByUserID(username);
    if( (curDT == null) || (curDT.Count != 1) ) return null;

    MembershipUser retVal = new MembershipUser("OMLMembershipProvider", username, curDT[0].idnum,
    curDT[0].email, String.Empty, "Comments!", true, false, DateTime.MinValue,
    DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue);

    return retVal;
    }

    public override MembershipUser GetUser( object providerUserKey, bool userIsOnline )
    {
    if( !( providerUserKey is int ) )
    throw new ApplicationException("OMLMembershipProvider::GetUser() -- supplied providerUserKey is not an integer");

    membership.bd_userDataTable curDT = ta.GetDataByUserIDNum((int) providerUserKey);
    if( ( curDT == null ) || ( curDT.Count != 1 ) ) return null;

    MembershipUser retVal = new MembershipUser("OMLMembershipProvider", curDT[0].user_id, curDT[0].idnum,
    curDT[0].email, String.Empty, "Comments!", true, false, DateTime.MinValue,
    DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue);

    return retVal;
    }

    public override string GetUserNameByEmail( string email )
    {
    email = email.ToLower();

    membership.bd_userDataTable curDT = ta.GetDataByEmail(email);
    if( ( curDT == null ) || ( curDT.Count != 1 ) ) return null;

    return curDT[0].user_id;
    }

    public override bool DeleteUser( string username, bool deleteAllRelatedData )
    {
    username = username.ToLower();

    membership.bd_userDataTable curDT = ta.GetDataByUserID(username);
    if( ( curDT == null ) || ( curDT.Count != 1 ) ) return false;

    curDT[0].Delete();
    ta.Update(curDT);

    return true;
    }

    public override MembershipUserCollection GetAllUsers( int pageIndex, int pageSize, out int totalRecords )
    {
    membership.bd_userDataTable curDT = ta.GetData();

    totalRecords = curDT.Count;

    MembershipUserCollection retVal = new MembershipUserCollection();

    for( int row = pageIndex * pageSize; row < ( pageIndex + 1 ) * pageSize; row++ )
    {
    if( row >= ( totalRecords - 1 ) ) break;

    retVal.Add(new MembershipUser("OMLMembershipProvider", curDT[row].user_id, curDT[row].idnum,
    curDT[row].email, String.Empty, "Comments!", true, false, DateTime.MinValue,
    DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue));
    }

    return retVal;
    }

    public override int GetNumberOfUsersOnline()
    {
    return 1;
    }

    public override MembershipUserCollection FindUsersByEmail( string emailToMatch, int pageIndex, int pageSize, out int
    totalRecords )
    {
    emailToMatch = emailToMatch.ToLower();

    membership.bd_userDataTable curDT = ta.GetDataByEmailPattern(emailToMatch);

    totalRecords = curDT.Count;

    MembershipUserCollection retVal = new MembershipUserCollection();

    for( int row = pageIndex * pageSize; row < ( pageIndex + 1 ) * pageSize; row++ )
    {
    if( row >= ( totalRecords - 1 ) ) break;

    retVal.Add(new MembershipUser("OMLMembershipProvider", curDT[row].user_id, curDT[row].idnum,
    curDT[row].email, String.Empty, "Comments!", true, false, DateTime.MinValue,
    DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue));
    }

    return retVal;
    }

    public override MembershipUserCollection FindUsersByName( string usernameToMatch, int pageIndex, int pageSize, out int
    totalRecords )
    {
    usernameToMatch = usernameToMatch.ToLower();

    membership.bd_userDataTable curDT = ta.GetDataByUserIDPattern(usernameToMatch);

    totalRecords = curDT.Count;

    MembershipUserCollection retVal = new MembershipUserCollection();

    for( int row = pageIndex * pageSize; row < ( pageIndex + 1 ) * pageSize; row++ )
    {
    if( row >= ( totalRecords - 1 ) ) break;

    retVal.Add(new MembershipUser("OMLMembershipProvider", curDT[row].user_id, curDT[row].idnum,
    curDT[row].email, String.Empty, "Comments!", true, false, DateTime.MinValue,
    DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue));
    }

    return retVal;
    }
    }

    RoleProvider
    =========
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.SqlClient;
    using System.Configuration;
    using System.Web;
    using System.Web.Configuration;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;

    /// <summary>
    /// Summary description for roles
    /// </summary>
    public class OMLRoleProvider : RoleProvider
    {
    private membershipTableAdapters.bd_userTableAdapter ta;

    public override void Initialize( string name, System.Collections.Specialized.NameValueCollection config )
    {
    base.Initialize(name, config);

    ta = new membershipTableAdapters.bd_userTableAdapter();

    string env = WebConfigurationManager.AppSettings["environment"];
    ta.Connection.ConnectionString = WebConfigurationManager.ConnectionStrings[env].ConnectionString;
    }

    private RoleFlags TextToFlag( string flagName )
    {
    RoleFlags retVal = RoleFlags.None;

    try
    {
    retVal = (RoleFlags) Enum.Parse(typeof(RoleFlags), flagName, true);
    }
    catch { }

    return retVal;
    }

    private RoleFlags TextToFlag( string[] flagNames )
    {
    RoleFlags retVal = RoleFlags.None;

    foreach( string curFlag in flagNames )
    {
    try
    {
    retVal |= (RoleFlags) Enum.Parse(typeof(RoleFlags), curFlag, true);
    }
    catch { }
    }

    return retVal;
    }

    public override string ApplicationName
    {
    get { return "OMLRoleProvider"; }

    set
    {
    throw new Exception("The method or operation is not implemented.");
    }
    }

    public override bool IsUserInRole( string username, string roleName )
    {
    RoleFlags toCheck = TextToFlag(roleName);
    if( toCheck == RoleFlags.None ) return false;

    object queryVal = ta.GetUserRoles(username.ToLower());
    if( queryVal == System.DBNull.Value ) return false;

    RoleFlags roleFlags = (RoleFlags) queryVal;

    return ( ( roleFlags & toCheck ) == toCheck ) ;
    }

    public override string[] GetRolesForUser( string username )
    {
    object queryVal = ta.GetUserRoles(username.ToLower());
    if( queryVal == System.DBNull.Value ) return new string[0];

    RoleFlags roleFlags = (RoleFlags) queryVal;
    RoleFlags[] allRoles = (RoleFlags[]) Enum.GetValues(typeof(RoleFlags));

    List<string> roles = new List<string>();
    foreach( RoleFlags curFlag in allRoles )
    {
    if( ( roleFlags & curFlag ) == curFlag )
    roles.Add(Enum.GetName(typeof(RoleFlags), curFlag));
    }

    return roles.ToArray();
    }

    public override void CreateRole( string roleName )
    {
    throw new ApplicationException("You can't create additional roles with the OMLRoleProvider");
    }

    public override bool RoleExists( string roleName )
    {
    bool isOkay = false;
    try
    {
    RoleFlags dummy = (RoleFlags) Enum.Parse(typeof(RoleFlags), roleName, true);
    isOkay = true;
    }
    catch { }

    return isOkay;
    }

    public override bool DeleteRole( string roleName, bool throwOnPopulatedRole )
    {
    throw new ApplicationException("You can't create delete roles with the OMLRoleProvider");
    }

    public override void AddUsersToRoles( string[] usernames, string[] roleNames )
    {
    RoleFlags toAdd = TextToFlag(roleNames);

    membership.bd_userDataTable userDT = ta.GetData();

    foreach( string curUser in usernames )
    {
    membership.bd_userRow[] userRows = (membership.bd_userRow[]) userDT.Select("user_id='" + curUser.ToLower() + "'");
    if( userRows.Length != 1 ) continue;

    userRows[0].flags |= (int) toAdd;

    ta.Update(userRows[0]);
    }
    }

    public override void RemoveUsersFromRoles( string[] usernames, string[] roleNames )
    {
    RoleFlags toRemove = TextToFlag(roleNames);
    toRemove = ~toRemove;

    membership.bd_userDataTable userDT = ta.GetData();

    foreach( string curUser in usernames )
    {
    membership.bd_userRow[] userRows = (membership.bd_userRow[]) userDT.Select("user_id='" + curUser.ToLower() + "'");
    if( userRows.Length != 1 ) continue;

    userRows[0].flags &= (int) toRemove;

    ta.Update(userRows[0]);
    }
    }

    public override string[] GetUsersInRole( string roleName )
    {
    int toCheck = (int) TextToFlag(roleName);

    membership.bd_userDataTable theDT = ta.GetData();
    List<string> users = new List<string>();
    foreach( membership.bd_userRow curRow in theDT )
    {
    if( ( curRow.flags & toCheck ) == toCheck )
    users.Add(curRow.user_id);
    }

    return users.ToArray();
    }

    public override string[] GetAllRoles()
    {
    return Enum.GetNames(typeof(RoleFlags));
    }

    public override string[] FindUsersInRole( string roleName, string usernameToMatch )
    {
    int toCheck = (int) TextToFlag(roleName);

    membership.bd_userDataTable curDT = ta.GetDataByUserIDPattern(usernameToMatch);

    List<string> users = new List<string>();
    foreach( membership.bd_userRow curRow in curDT )
    {
    if( ( curRow.flags & toCheck ) == toCheck )
    users.Add(curRow.user_id);
    }

    return users.ToArray();
    }
    }

    RoleFlags (used by RoleProvider)
    ========================
    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;

    [Flags]
    public enum RoleFlags : int
    {
    None = 0,
    SysAdmin = 1,
    RegisteredUser = 2,
    }

    Web.config (I've redacted the keys for privacy reasons)
    ========
    <membership defaultProvider="OMLMembershipProvider">
    <providers>
    <add name="OMLMembershipProvider"
    type="OMLMembershipProvider" />
    </providers>
    /membership>

    <roleManager enabled="true" defaultProvider="OMLRoleProvider">
    <providers>
    <add name="OMLRoleProvider"
    type="OMLRoleProvider" />
    </providers>
    </roleManager>

    <machineKey
    decryption="AES"
    validation="SHA1"
    validationKey="redacted"
    decryptionKey="redacted"
    />
    Mark Olbert, Jan 10, 2006
    #3
  4. Mark Olbert

    Mark Olbert Guest

    Okay, I found how to debug the ASPNET Configuration utility. Previously, I was attaching VS2005 to the iexplorer process which was
    displaying the config pages. Turns out you need to attach to the instance of the server which is generating the configuration
    website (no duhh...it was late, and I was tired, and I forgot to scroll down the process list to see all the choices before picking
    one).

    After doing that I was able to set breakpoints on my custom provider classes and walk through the Configuration code. It took about
    30 seconds to find the bug after I was able to do that.

    - Mark
    Mark Olbert, Jan 10, 2006
    #4
  5. Mark Olbert

    Mark Olbert Guest

    Steven,

    Apologies for the confusion, but while I was able to fix some of the problems by attaching the debugger to the ASPNET Configuration
    tool server process, the original problem still exists. That's the one that complains about not being able to load the custom class
    which defines my custom MembershipUser object.

    This has the feel to me of an incomplete Type name specification problem (e.g., where the Assembly name must be appended to the
    class name to make a fully-qualified Type name), but I'm not sure. Is there a Web.config element where you specify the custom
    MembershipUser class to use? I haven't been able to find one.

    - Mark
    Mark Olbert, Jan 10, 2006
    #5
  6. Mark Olbert

    Mark Olbert Guest

    I should also have mentioned that watching the ASPNET Configuration tool in the debugger shows that the call to GetAllUsers()
    succeeds (i.e., instances of my custom MembershipUser class are created, added to MembershipUserCollection and returned). The
    failure to load the Type occurs after the call to GetAllUsers().

    - Mark
    Mark Olbert, Jan 10, 2006
    #6
  7. Thanks for your response Mark,

    So is there any particular custom types used in your membership provider
    which is separated from your main class file (of the provider)? Also, I
    think you can also consider pull the custom provider code out of the
    asp.net application, make them in a separate class library project (include
    in the same solution), then you can add the reference to the compiled class
    library project and don't need to let the provider classes dynamically
    compiled.... This may make the assembly name clear...

    Thanks,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)


    --------------------
    | NNTP-Posting-Date: Tue, 10 Jan 2006 12:18:17 -0600
    | From: Mark Olbert <>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | Subject: Re: Extending MembershipUser
    | Date: Tue, 10 Jan 2006 10:18:17 -0800
    | Organization: Olbert & McHugh, LLC
    | Reply-To:
    | Message-ID: <>
    | References: <>
    <>
    <>
    | X-Newsreader: Forte Agent 3.1/32.783
    | MIME-Version: 1.0
    | Content-Type: text/plain; charset=us-ascii
    | Content-Transfer-Encoding: 7bit
    | Lines: 5
    | X-Trace:
    sv3-oQ3W88ujgM+5qN3ILD8GVFlh2nizLRSue7cVZ5ZYcaONFL/rjvjrklEr4JexW/BXEaU2H2mR
    +BbCwom!1X6uAcdN6TAeAVJqqhC0Wt/zJwrCsvWu/fIqtH9r4ca9dblbg2X1Ip9Q20CwaNW1NchG
    Bg==
    | X-Complaints-To:
    | X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
    | X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
    | X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
    complaint properly
    | X-Postfilter: 1.3.32
    | Path:
    TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
    ne.de!border2.nntp.dca.giganews.com!news-out.readnews.com!news-xxxfer.readne
    ws.com!216.196.98.140.MISMATCH!border1.nntp.dca.giganews.com!nntp.giganews.c
    om!local01.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail
    | Xref: TK2MSFTNGXA02.phx.gbl
    microsoft.public.dotnet.framework.aspnet:369862
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    |
    | I should also have mentioned that watching the ASPNET Configuration tool
    in the debugger shows that the call to GetAllUsers()
    | succeeds (i.e., instances of my custom MembershipUser class are created,
    added to MembershipUserCollection and returned). The
    | failure to load the Type occurs after the call to GetAllUsers().
    |
    | - Mark
    |
    Steven Cheng[MSFT], Jan 11, 2006
    #7
  8. Mark Olbert

    Mark Olbert Guest

    Steven,

    A clever idea, thanx...but unfortunately it doesn't work. It does change the error message, though: now it claims not to be able to
    resolve the extended MembershipUser Type. I've used fuslogvw to confirm that the assembly defining the Type gets loaded (it does).

    Can you please refer this problem up the line? Basically, I want to know one of two things:

    1) How do I derive from MembershipUser such that the ASP.NET Configuration tool will work with the derived class? I don't expect
    Configuration to display or manipulate any fields/properties I may add. But it needs to not blow up.

    2) Confirm that (1) cannot be done under NET 2.0 so that I can move on to other issues.

    - Mark
    Mark Olbert, Jan 11, 2006
    #8
  9. Hi Mark,

    So far I haven't found any document mentioned that custom providers are not
    supported in WebAdmin page since the web admin page manage the providers
    through their base abstracted interfaces... There may still have something
    incorrect that cause the problem. Here are some general simple custom
    provider examples in MSDN:

    #Hands-on Custom Providers: The Contoso Times
    http://msdn.microsoft.com/library/en-us/dnaspp/html/ASPNETProvMod_Prt9.asp?f
    rame=true

    Thanks,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)



    --------------------
    | NNTP-Posting-Date: Wed, 11 Jan 2006 10:17:16 -0600
    | From: Mark Olbert <>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | Subject: Re: Extending MembershipUser
    | Date: Wed, 11 Jan 2006 08:17:16 -0800
    | Organization: Olbert & McHugh, LLC
    | Reply-To:
    | Message-ID: <>
    | References: <>
    <>
    <>
    <>
    <>
    | X-Newsreader: Forte Agent 3.1/32.783
    | MIME-Version: 1.0
    | Content-Type: text/plain; charset=us-ascii
    | Content-Transfer-Encoding: 7bit
    | Lines: 13
    | X-Trace:
    sv3-2GzKdEuOhpGXIiixat2cTo/VA2lfh+DlXyudA7bNiAS0fMmHblBJzRCnQe7vYAWcDqWEygNt
    dtpphvV!+pur7hb+ckKJDehctqLX8Q8ay6IYdsQ1ddsSWM+yFw9VDg0d9S3mHPKr2JaOW9KEgZSC
    IA==
    | X-Complaints-To:
    | X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
    | X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
    | X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
    complaint properly
    | X-Postfilter: 1.3.32
    | Path:
    TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado.fa
    stwebnet.it!tiscali!newsfeed1.ip.tiscali.net!news.glorb.com!border1.nntp.dca
    ..giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!news.giganews.
    com.POSTED!not-for-mail
    | Xref: TK2MSFTNGXA02.phx.gbl
    microsoft.public.dotnet.framework.aspnet:370110
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    |
    | Steven,
    |
    | A clever idea, thanx...but unfortunately it doesn't work. It does change
    the error message, though: now it claims not to be able to
    | resolve the extended MembershipUser Type. I've used fuslogvw to confirm
    that the assembly defining the Type gets loaded (it does).
    |
    | Can you please refer this problem up the line? Basically, I want to know
    one of two things:
    |
    | 1) How do I derive from MembershipUser such that the ASP.NET
    Configuration tool will work with the derived class? I don't expect
    | Configuration to display or manipulate any fields/properties I may add.
    But it needs to not blow up.
    |
    | 2) Confirm that (1) cannot be done under NET 2.0 so that I can move on to
    other issues.
    |
    | - Mark
    |
    Steven Cheng[MSFT], Jan 12, 2006
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. brett_fyisystems

    MembershipUser implementation

    brett_fyisystems, Nov 2, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    668
    brett_fyisystems
    Nov 2, 2005
  2. Mark Olbert
    Replies:
    9
    Views:
    3,141
    Luke Zhang [MSFT]
    Jan 20, 2006
  3. mark d.
    Replies:
    0
    Views:
    858
    mark d.
    Feb 6, 2006
  4. Jeff
    Replies:
    3
    Views:
    1,110
    9-11 Was An Inside Job
    Mar 29, 2007
  5. CSharpner
    Replies:
    1
    Views:
    810
Loading...

Share This Page