2

In my app I want to add properties to the user class. How should I do it?

My current solution is to create Users table in th database, but I just read that Asp.Net provides out-of-the-box users registration API and functionality. How can I update the new properties?

Thank you

2 Answers 2

1

Do you mean you want a custom Principal? In that case you want to hook into the AuthenticateRequest method and add your own, derived principal. I recently answered a question regarding the creation of a custom principal here. While that question deals with WindowsAuthentication, the idea is the same:

  1. Get the current authenticated principal,
  2. use it to create your own custom principal,
  3. set your principal on the HttpContext and Thread.
Sign up to request clarification or add additional context in comments.

Comments

0

You can write a custom Membership Provider that plugs into the membership & authorization features built into the framework. You can also write your own custom User class that inherits from the standard class. You can design it so that it uses your existing users table if you want.

This has worked out well for us on a couple different projects.

Here's some documentation: http://msdn.microsoft.com/en-us/library/f1kyba5e.aspx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.