Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7060103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:18:44+00:00 2026-05-28T04:18:44+00:00

I’m implementing my custom Membership provider and I need to implement some additional fields

  • 0

I’m implementing my custom Membership provider and I need to implement some additional fields (such as first name, last name, country, etc).

I know I can extend MembershipUser class and cast to it when I return aa user object from my provider. The thing which I can’t find how to do and if it is possible to do is how to actually pass these custom properties to my provider when I’m creating a new user Membership.CreateUser(...) during user registration.

Is it possible at all? If yes, how it can be done?

Thanks

UPDATE

MSDN article says

However, this overload will not be called by the Membership class or
controls that rely on the Membership class, such as the
CreateUserWizard control. To call this method from an application,
cast the MembershipProvider instance referenced by the Membership
class as your custom membership provider type, and then call your
CreateUseroverload directly.

Membership in this case is a reference to a instance of the class and at the same time it is a class by itself.

Neither

((CustomMembershipProvider)Membership).CreateUser(...);

nor

(CustomMembershipProvider)Membership.CreateUser(...);

works.

How should I cast it in this case?

UPDATE: See my answer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:18:45+00:00Added an answer on May 28, 2026 at 4:18 am

    I figured out how to do correct casting, so here it is:

    custom membership provider:

    public sealed class CustomMembershipProvider : MembershipProvider {...}
    

    custom membership user:

    public class CustomMembershipUser : MembershipUser {...}
    

    To create new custom user:

    CustomMembershipProvider myProvider = (CustomMembershipProvider)Membership.Provider;
    CustomMembershipUser user = (CustomMembershipUser)myProvider.CreateUser(...);
    

    To get custom user:

    CustomMembershipProvider myProvider = CustomMembershipProvider)Membership.Provider;
    CustomMembershipUser user = (CustomMembershipUser)myProvider.GetUser(...);
    

    And this article shows how to implement custom user: http://msdn.microsoft.com/en-us/library/ms366730.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I need to clean up various Word 'smart' characters in user input, including but
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
In my XML file chapters tag has more chapter tag.i need to display chapters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.