By adding the queryparameter allowCookies=on or allowCookies=off cookies will be disabled or enabled.
(cookis are enabled by setting an allowCookies cookie with the value "on")

- On the server side a http-module attached to the ResponseEnd event will clear all cookies if they are not enabled
- On the client side a javascript will wait 1200 milliseconds before clearing all cookies which may have been set via 3rd party javascript includes (such as google analytics)
- The HttpModule can be configured to work on a limited number of hostnames, just add them as a comma separated list in the app-setting "CookieRestrictions.ValidHostnames"
- The javascript is placed in \resources\js\CookieRestrictions.js and must be included manualy if needed

Install-Package CookieRestrictions -Version
dotnet add package CookieRestrictions --version
<PackageReference Include="CookieRestrictions" Version="" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CookieRestrictions --version
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

Version - Silent Handling now based on error number instead of exception message
Version - Silent Handling of not being able to change cookies in request due to Flushed request content
Version - Fixed Cookies from httpOnly true to false, and a typo in js
Version - Implementet so the configuration can be overwriten
Version - Implemented surpress cookie warning.
Version - Fixed allow cookie validation in util class.
Version - Added a util class
Version - added the CookieRestrictionsContext.HostnameIsValid property so its easier to check if the javascript should be included


This package has no dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated 716 6/3/2014 483 1/15/2014 430 1/14/2014 623 1/28/2013 640 11/23/2012 875 2/24/2012
1.0.0 742 1/12/2012