作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在使用 MVC 4 Web API 和匿名识别模块来为我的应用程序中的购物车识别匿名用户。这是我添加到我的 web.config 文件中的值:
<anonymousIdentification enabled="true" />
我可以在普通 Controller
中访问 Request.AnonymousID
,但不能在 ApiController
中访问。我怎样才能访问它?
最佳答案
添加以下using语句
using System.Web;
然后使用:
HttpContext.Current.Request.AnonymousID
关于c# - ApiController 中的 Request.AnonymousID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20026430/
我有一个 ASP.NET MVC 站点。当网站上出现错误时,我想记录异常以及 Request.AnonymousID 的值,以便能够发现是一个用户遇到 20 个错误,还是 20 个用户遇到相同的错误.
我正在使用 MVC 4 Web API 和匿名识别模块来为我的应用程序中的购物车识别匿名用户。这是我添加到我的 web.config 文件中的值: 我可以在普通 Controller 中访问 Req
我是一名优秀的程序员,十分优秀!