【发布时间】:2021-11-03 09:32:32
【问题描述】:
谁能帮我解决这个问题?我被告知我不能将 Key/Credentials 保留在控制器中,所以我尝试从配置文件中检索它并能够打印该值,但我无法在操作过滤器属性中使用它
[HttpPost]
[CaptchaValidator(PrivateKey ="123")] //This works
[CaptchaValidator(PrivateKey = System.Configuration.ConfigurationManager.AppSettings["myKey"])] //Error "Argument must be constant expression"
public ViewResult myForm()
{
//...
}
【问题讨论】:
标签: c# asp.net-mvc