Request.AnonymousID in ApiController

I use the MVC 4 Web API and an anonymous authentication module to identify anonymous users for the shopping cart in my application. This is the value I added to the web.config file:

<anonymousIdentification enabled="true" />

I can access Request.AnonymousIDin the usual Controller, but not in ApiController. How can I access it?

+4
source share
1 answer

add the following instruction

using System.Web;

then use:

HttpContext.Current.Request.AnonymousID
+5
source

All Articles