ASP.NET MVC 3 - Various Login Pages for the Authorization Attribute

I have forms authentication connected for my MVC 3 application. Usually, when a request arrives for which authentication is required, they are sent to my login controller, where they should be logged in.

However, I want a different view for this particular workflow, because I plan on using white labels for my clients. Instead, I want them to go to another endpoint of my login controller in order to display my custom login window.

What options should I make for this to work?

+4
source share
2 answers

Can you talk about what you mean by a white sign? What content will be changed and what will it depend on?

In your Web.config file, find

 <system.web> <authentication mode="Forms"> <forms loginUrl="/Login/Index" /> </authentication> 

Change the loginUrl attribute as you want. Then, in the login action, select the correct view to return.

You will need a certain type of identifier in order to distinguish clients (subdomain, cookie or something else). Use this to choose the right type for return.

+8
source

Not sure what exactly you are doing, but on condition that the user tries to go to this page:

 http://example.com/Customer1/Index 

and you want to redirect to

 http://example.com/Customer1/Login 

Suppose your regular login page is here:

 http://example.com/Account/Login 

You will get the query string parameter ReturnUrl . Thus, the request will go to your login page as follows:

 http://example.com/Account/Login?ReturnUrl=/Customer1/Index 

So, you can examine this parameter to determine where to redirect.

+1
source

All Articles