0

I'm looking into how to integrate [Authorize] within my MVC 2 application... I'm reading articles about it and I've run the aspnet_regsql tool. I see that my database now containes a bunch of new tables and a whole hell of a lot of SPROCs.

Why is all of this necessary? I thought that I would be able to check login credentials in a table that I've already created for Party ... can't I just call a SPROC that checks the login credentials and then logs the user in? Why all of these new tables and SPROCs?

2 Answers 2

1

Because it is the way how it is works. If you using ASP.NET Membership by default you need to have database aspnetdb with lots of tables and stored procs. If you want you may customize that. In order to do that you need to implement custom membership provider.

The simple example how to do that you may find here http://msdn.microsoft.com/en-us/library/aa479048.aspx and here http://www.asp.net/general/videos/how-do-i-create-a-custom-membership-provider also source code available.

Sign up to request clarification or add additional context in comments.

2 Comments

So if I want to integrate authentication, I have to clutter my DB with all of those tables and SPROCs?
@dcolumbus It depends what you want to achieve, you may not clutter your DB at all. To simplify all that you may have only one table where you will store you logins.
1

It sounds like you want to create a custom membership provider. For logging in I think you really only need to override the ValidateUser method: http://msdn.microsoft.com/en-us/library/f1kyba5e.aspx

For roles you may be able to get by with overriding only the IsUserInRole method: http://msdn.microsoft.com/en-us/library/8fw7xh74.aspx

1 Comment

Yeah, I don't really need roles at this moment... although it would be nice to know how to do that with my own database as well. Thanks, I'll look into these.

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.