阻止公共方法被调用
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 using System.Web.Mvc; 2 3 namespace MvcApplication1.Controllers 4 { 5 public class WorkController : Controller 6 { 7 [NonAction]//拒绝动作 8 public string CompanySecrets() 9 { 10 return "This information is secret."; 11 } 12 13 } 14 }
阻止公共方法被调用
1 using System.Web.Mvc; 2 3 namespace MvcApplication1.Controllers 4 { 5 public class WorkController : Controller 6 { 7 [NonAction]//拒绝动作 8 public string CompanySecrets() 9 { 10 return "This information is secret."; 11 } 12 13 } 14 }
转载于:https://www.cnblogs.com/Setme/p/3553519.html