Implementing Do not track in asp.net mvc

血红的双手。 提交于 2019-12-07 08:40:44

问题


How do I implement do not track browser consent from asp.net mvc3? Do all major browsers like IE, Firefox and Chrome send some cookie consent request if the user has set do not track settings enabled in their browser?


回答1:


"Do Not Track" just means that the browser sends the DNT header with every request, that's all it is. It does not provide any additional client functionality. The header has a value of 1 when enabled, and either sends 0 or omits the header when disabled.

You, as a web application developer, do not need to concern yourself with the DNT header unless you are involved in developing visitor tracking systems, in which case the higher-ups in your organisation will tell you if you should respect the header or not.

In ASP.NET you can retrieve the header like so:

String doNotTrack = Request.Headers["DNT"];
if( doNotTrack == "1" ) {
    // Do not track the user
    // ...whatever that means.
}


来源:https://stackoverflow.com/questions/20435263/implementing-do-not-track-in-asp-net-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!