简体   繁体   中英

Why isn't the un-authenticated user automatically redirected to the Login page with Membership API?

Building a sample ASP.NET MVC app. Using the Membership API for authentication. For whatever reason, the code execution first goes to the default route (eg HomeController.Index method) instead of going to the specified login page.

My web.config is as follows:

<authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>

What am I missing?

您需要在ActionController上放置[Authorize]属性

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM