1

I have an ASP.NET MVC3 project and I need to implement authentification for this one.

To authenticate the user, I want to use forms authentication with an existing user table which stores username/password. After that, with GlobalActionFilterAttribute, I would check if user has access to data he wants.

So, how can i easily implement forms authentication with personnal tables ?

Thanks in advance.

2 Answers 2

5

You could do this other ways, but I would look at writing a MembershipProvider (and RoleProvider, if necessary), that uses your existing tables as the authorization store. Plug these into your web.config and you can use the existing AuthorizeAttribute and login code provided in template solution. Don't be intimidated by the signature on the MembershipProvider. The methods are typically easy to write and if you don't actually use them, you can leave them unimplemented.

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

1 Comment

+1 as well. The MSDN docs may be a bit verbose, but it is pretty straight forward. Look @ the default MVC project that gets created in visual studio and it'll get you started. The Account model should have what you need.
0

I provided this answer some time ago, maybe you can find it useful.

You may also find this other post useful for implementing your custom authentication method.

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.