Skip to main content
net8.0net9.0net10.0

.NET wrapper to get or set Mark of the Web, a metadata identifier used by Microsoft Windows to mark files downloaded from the Internet as potentially unsafe

Published
Dec 7, 2025
10mo ago
Total Downloads
3.1K
3,146

Install

dotnet add package Meziantou.Framework.Win32.MarkOfTheWeb --version 1.0.9
ProductVersions
.NET
net10.0net8.0net9.0

README

Mark of the Web

The Mark of the Web (MOTW) is a security feature in Windows that helps protect users from potentially unsafe content downloaded from the internet. It is implemented by adding a special comment to the beginning of HTML files and other web-related files, indicating that the file originated from the internet. When a user attempts to open a file with MOTW, Windows may display a warning message or restrict certain actions, such as running scripts or accessing certain features, to help prevent potential security risks.

Usage

To add the Mark of the Web to a file, you can use the MarkOfTheWeb class provided in this library. Here's an example of how to use it:

// Add the Mark of the Web to a file
MarkOfTheWeb.SetFileZone(path, UrlZone.Internet);

// Get the Mark of the Web zone of a file
var zone = MarkOfTheWeb.GetFileZone(path);

// Remove the Mark of the Web from a file
MarkOfTheWeb.RemoveFileZone(path);

Changes from Previous Version

No structural changes between v1.0.8 and v1.0.9.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

Compatibility metadata lists 3 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.