Skip to main content

IIS / ASP.NET Core

Integrate CMP with ASP.NET Core applications.

Installation

Add the CMP script to your layout:

<!-- In _Layout.cshtml -->
<script src="https://cmp.digiwedge.com/loader.js"
data-site-id="@Configuration["CMP:SiteId"]">
</script>
public class ConsentMiddleware
{
public async Task InvokeAsync(HttpContext context)
{
var consent = context.Request.Cookies["cmp_consent"];
// Check consent before loading analytics
}
}

Configuration

Add to appsettings.json:

{
"CMP": {
"SiteId": "your-site-id"
}
}