阻止公共方法被调用
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 }