Вы можете сделать это, отправив следующий запрос патча:
PATCH https://graph.microsoft.com/v1.0/groups/<groupid>/onenote/pages/<pageid> HTTP/1.1
Authorization: <bearer token>
User-Agent: Java-Client
Accept-Encoding: gzip,deflate
Accept: application/json, text/json
Content-Type: application/json
Host: graph.microsoft.com
Connection: keep-alive
Content-Length: 14
{"level": "1"}
Кажется, это работает ... есть ли лучший / более подходящий способ в ASP.NET MVC 1?
if (filterContext.Controller.GetType().GetCustomAttributes(typeof(RequireHttpsAttribute), true).Length > 0)
return;
string action = (string)filterContext.RouteData.Values["action"];
if (!string.IsNullOrEmpty(action) && filterContext.Controller.GetType().GetMethod(action).GetCustomAttributes(typeof(RequireHttpsAttribute), true).Length > 0)
return;
это работало на меня в.NET Core 2.2:
var controllerActionDescriptor = actionContext. ActionDescriptor как ControllerActionDescriptor;
if (controllerActionDescriptor != null)
{
// Check if the attribute exists on the action method
if (controllerActionDescriptor.MethodInfo?.GetCustomAttributes(inherit: true)?.Any(a => a.GetType().Equals(typeof(CustomAttribute))) ?? false)
return true;
// Check if the attribute exists on the controller
if (controllerActionDescriptor.ControllerTypeInfo?.GetCustomAttributes(typeof(CustomAttribute), true)?.Any() ?? false)
return true;
}