locked
ASP.NET Core MVC - Form Based Authentication RRS feed

  • Question

  • User135423268 posted

    I just starting to create a application on ASP.NET Core for our company, now on my previous ASP.Net MVC projects, I'm using the Form Based Authentication, which is working on my MVC Projects, I want to incorporate it on my MVC .NetCore project but I'm having trouble on it, for example, I configure the login page on the web.config on my MVC project, I tried to add a web.config on my .NetCore MVC, and add the same configuration but it's not working.

    What I want to do is when the user visit the page it will redirect him/her to the login page.

    here's the configuration:

        <sessionState mode="InProc" cookieless="false" timeout="90" regenerateExpiredSessionId="false" />
        <authentication mode="Forms">
          <forms loginUrl="~/account/login" defaultUrl="~/Home/Index" timeout="90" slidingExpiration="false" />
        </authentication>

    Here's my code for on my authentication:

                                    FormsAuthentication.SetAuthCookie(LoginInfo.Username, False)
                                    FormsAuthentication.RedirectFromLoginPage(LoginInfo.Username.Trim, False)

    Now the reason why we are using this authentication instead of Claims/Roles and EntityFramework because we are still using our old authentication databases and we are still not looking to change it. I hope someone can help me on this.

    Thanks and regards.

    Friday, September 11, 2020 2:58 AM

Answers