1

在我的 ASP.Net Web API 项目中,我向[Authorize]控制器添加了属性。因此,当我调用该方法时,它返回错误为

"Message": "Authorization has been denied for this request."

如何Authorize连同我的请求一起发送标头。

控制器

[Authorize]
[HttpPost]
public HttpResponseMessage Settings(SettingModel data)
{
    --Do i need to check authorize headers manually here?
    --code goes here
}

这里叫做

http://localhost/sample/api/Settings

Headers
{
   Content-Type: application/json
   Authorization: What value need to be send here?
}
4

1 回答 1

0

检查 Darin 的答案:How to do role based authorization for asp.net mvc 4 web api

我想你需要注册处理程序..

于 2013-06-20T04:32:26.517 回答