ASP.Net MVC 5 how to use Authorize Attribute with multiple login (Multiple user table)

silviagreen

I'm new to ASP.NET MVC 5. In the project I'm developing I have two user tables: one for clients and one for employees. I need to create two distinct login forms: one for clients and one for employees. The clients will have access to a particular part of the website, the employees will have access to another distinct part. Each part has its own actions. How can use the Authorize Attribute in order to distringuish clients from employees?

Oswald Umeh

About creating different login forms, that won't be necessary at all. You can use one login form for both roles but depending on what you want either to see when logged in, you make use of User.IsInRole to verify and maybe redirect them or some other course action of your choice.

This is of course in addition to the answer provided by "The Akhemist".

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to create a Custom Authorize Attribute by comparing User Id stored in table with Current User Id in Asp.net MVC 5?

How to override Authorize attribute in ASP.MVC 5 with multiple authorization conditions?

How to create a custom attribute that will redirect to Login if it returns false, similar to the Authorize attribute - ASP.NET MVC

How to authorize user who logged in using external login in Asp.Net MVC

How [Authorize] attribute get to know that the user is authenticate in ASP.NET MVC, is it by using authentication token?

Generic Authorize Attribute multiple Roles ASP.NET Core

Using Asp.Net Core Identity in MVC, Authorize attribute is rebouncing to login page after succesfull login

Custom Authorize Attribute on asp.net mvc

Does anyone have a good explanation on how the [Authorize] Attribute handles routes in a standard ASP.NET MVC 5 application?

ASP.NET Core 3.1 [Authorize] attribute redirects to login even for logged in user

How to use multiple submit buttons in ASP.NET MVC

Redirect to login with attribute Authorize using cookies authentication in ASP.NET 5

Authorize Attribute with Multiple Roles

Redirection to User Profile After Login in ASP.NET MVC 5

Multiple remote validation attribute in ASP.NET MVC4

How to save multiple data with same name attribute in ASP.NET MVC?

Regarding Authorize attribute usage in ASP.Net MVC 4

Asp.net Core MVC Authorize Attribute not blocking

Multiple User Roles in Authorize

How to not have a null item in a collection in .net mvc with html 5 input with attribute "multiple"

Authorize attribute not working MVC 5

How to change user login credentials in identity asp.net mvc?

Dynamically add roles to authorize attribute for controller in ASP.NET 5

How to handle many to many same table (User) in ASP.Net MVC 5 - Fluent API

Same SessionID used for multiple months for user in ASP.NET MVC

Office 365 Outlook Calendar : How to access multiple user's calendar in a single ASP.NET MVC application?

ASP.NET MVC Authorize user with many roles

Asp.Net MVC authorize a custom user which extends ApplicationUser

ASP.NET MVC 5 Azure Website fails to connect to SQL Azure DB on some views due to role based [Authorize] attribute