Last post May 24, 2017 01:27 PM by JBetancourt
Apr 22, 2015 10:49 AM|Pyromanci2|LINK
I'm trying to learn ASP.Net MVC. I'm already decent at just plain c# for desktop applications and php. So I figured I would take a stab at learning the web side of the .NET now.
I figured I would dive right in the deep end and port a existing system I made in php (using Zend Framework which is similar in a number of ways to MVC). Everything has been going ok. I have the Data first Entity Models created and the base "template" and
I was now moving on to a Login when I hit a road block. I've spent the past 4 days reading and going through articles on the Membership and Role providers. As i wanted to try and using as much stock as I could. The problem is however the user system is a
little different then a standard site.
A user logs in 3 pieces of information. A Company ID, username, and password. The Login validation in the existing system goes like so:
1. Checks the company record to make sure it's real and if they are not disabled.
2. Queries the login table for a username with that company.
3. makes sure the password matches.
4. Final set a cookie and which to the companies database if authentication has passed. (1 central database for company information and logins. All other data is stored in segregated databases for each company.)
However everything I've read leads me to believe I can not do it this way with the built in components of ASP.Net MVC like the MembershipProvider, Identity, Principal, and Roles. Which results in me having to a complete custom Authentication and prevents
me from using annotations like [Authorize(Roles = "SuperAdmin")].
Because I'm learning this perhaps I've over looked something and was wanting a confirmation. if this is and someone has a link to tutorial that examples things that would be great.
May 24, 2017 01:27 PM|JBetancourt|LINK
why dont you just use company\username for the username and everything else will be standard.
When opening the database parse the username and build the connection string from the company part of the username
Please remember to click "Mark as Answer" the responses that resolved your issue.