-1

I use WebMatrix.WebData; In my MVC project, inside controller I wrote this line of code:

 [Authorize(Roles ="Members")]

When login fails, it will redirect my application to Home/Login. But I want to redirect to Home/Register. How can I do this?

1 Answers1

0

If you are working with web forms you should change your web.config file like this.

<system.web>
    <authentication mode="Forms">
        <forms loginUrl="~/Home/Register" timeout="30" />
    </authentication>
</system.web>

if you are not you can change LoginPath = new PathString("/Home/Register"), under ConfigureAuth method in Startup class inside App_Start/Startup.Auth.cs

Murat Seker
  • 890
  • 2
  • 14
  • 26