Reputation: 543
I am building a web service using web API controller. However, when I try to decorate any of my actions with [allowanonymous]
attribute it doesn't work... here is an image
I just would like to know what is goning wrong in here...
Upvotes: 2
Views: 2667
Reputation: 10695
Just had to remove this using:
using System.Web.Http;
Because that namespace is for WebAPI, whereas System.Web.Mvc
is for MVC Controllers. Using both namespaces in the same file may cause confusions for Authorize
and AllowAnonymous
, for example.
Upvotes: 1
Reputation: 3110
On the top of the page, use namespace
like:
using System.Web.Mvc;
Upvotes: 1
Reputation: 15227
Just fully qualify the name
[System.Web.Mvc.AllowAnonymous]
public ActionResult SomeAction()
{ ...
Upvotes: 3