Skip to content

Instantly share code, notes, and snippets.

@phylsys
Created March 13, 2017 19:10
Show Gist options
  • Save phylsys/cfa1b6e30a647857305f4f28d750128e to your computer and use it in GitHub Desktop.
Save phylsys/cfa1b6e30a647857305f4f28d750128e to your computer and use it in GitHub Desktop.
Web.config for /.well-known/ directory in an ASP.net application
<?xml version="1.0"?>
<configuration>
<system.web>
<!-- Make directory public. Allow anonymous users access to everything in this directory. -->
<authorization>
<allow users="*"/>
</authorization>
</system.web>
<system.webServer>
<!-- Directory only contains plain text files. -->
<staticContent>
<mimeMap fileExtension=".*" mimeType="text/plain" />
</staticContent>
<!-- Only static files are allowed, so remove everything but the StaticFile handler. This also solves the issue with extensionless files returning a 404 Page Not Found. -->
<handlers>
<clear />
<add name="StaticFile" path="*" verb="*" type="" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" scriptProcessor="" resourceType="Either" requireAccess="Read" allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
</handlers>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment