简体   繁体   中英

Request.AnonymousID in ApiController

I'm using MVC 4 Web API and the Anonymous Identification Module to identify anonymous users for a shopping cart in my application. This is the value I've added to my web.config file:

<anonymousIdentification enabled="true" />

I can access Request.AnonymousID in a normal Controller but not an ApiController . How can I access this?

add the following using statement

using System.Web;

then use:

HttpContext.Current.Request.AnonymousID

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM