ASP.NET MVC Forms authentication and unauthenticated controller actions

前端 未结 3 1572
Happy的楠姐
Happy的楠姐 2021-02-04 10:36

I have a ASP.NET MVC site that is locked down using Forms Authentication. The web.config has


    

        
3条回答
  •  借酒劲吻你
    2021-02-04 11:10

    Instead of securing all resources on your website by default and then looking for a way to provide anonymous access for individual resources, you're probably better off taking the opposite approach. Don't specify authorization rules in your web.config, then use Authorization filters (see Mickel's answer) to secure individual controllers and/or actions.

提交回复
热议问题