Search code examples
c#asp.net-mvcasp.net-mvc-4asp.net-membershipasp.net-identity

'AllowAnonymous' could not be found


Everything worked fine until I installed (Package Manager Console) the postal package, then uninstalled and installed an older version.

Now I get an error where it previously was not. Error:

The type or namespace name 'AllowAnonymous' could not be found (are you missing a using directive or an assembly reference?)

Who knows how to fix this?


Solution

  • Probably you are missing the reference to System.Web.Http assembly in your project?

    So you need to:

    • Add the reference to System.Web.Http;
    • Add using System.Web.Http; to your controller;

    To add Reference you need to do next steps:

    • In Solution Explorer, right-click the project node and click Add Reference.
    • In the Add Reference dialog box, select the tab Assemblies, and enter System.Web.Http into search on the right side.
    • Select the component System.Web.Http, and then click OK.

    Link:

    How to: Add or Remove References By Using the Add Reference Dialog Box