---
title: File Providers
slug: cms-12/docs/file-providers
docTags: 
createdAt: 2026-08-10T15:55:59.000Z
---

Optimizely products use [File Providers](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/file-providers?view=aspnetcore-5.0) to map files to virtual paths in the site. Protected modules use file providers so you can have a single physical location for the modules even though the virtual path on the site is configurable.

In addition to ASP.NET Core, two different file providers `ContentRootFileProvider` and `WebRootFileProvider` that are available on [IWebHostFileProvider](https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.iwebhostenvironment?view=aspnetcore-5.0) Optimizely Content Management System (CMS) also registers one instance of a `ICompositeFileProvider` that acts as a façade over the built-in provider but also supports additional provider registration. You can register custom file providers to the composite file provider through `CompositeFileProviderOptions`. The composite file provider is used to resolve resources from shell modules. The composite file provider is registered in the DI container.

The `MappingPhysicalFileProvider` is used to map in physical files, not directly under the application root. The following example shows a registration of a `MappingPhysicalFileProvider`:

```csharp
serviceCollection.Configure<CompositeFileProviderOptions>(c => {
    c.BasePathFileProviders.Add(new MappingPhysicalFileProvider("/SomeVirtualPath", string.Empty,
      Path.Combine(webHostEnvironment.ContentRootPath, @"SomePhysicalFolder")));                  
  });
```

CMS also contains a zip archive file provider you can use if files are stored in a zip archive. When shell modules are registered, a file provider is also automatically registered for the shell module. If the resources are packaged in a zip archive, an instance of `ZipArchiveFileProvider` is registered.
