Developer forum

Forum » Dynamicweb 10 » Static hosting of files in DynamicWeb 10.6.3

Static hosting of files in DynamicWeb 10.6.3

Joseph Vause


I have a requirement to host this file at:  'wwwroot/.well-known/apple-developer-merchantid-domain-association' for my implementation of Stripe to be able to work with Apple Pay Wallets

I have added:


to my program.cs that should allow this for a standard site. However there is likely something else i am missing.

When i go to this page, i get a dynamicWeb 404 page, which suggests the DynamicWeb routing is not allowing this to be accessed.

Does anyone know what else i need to do to allow this? 

I have the file properties set as:


In other (non-dynamicWeb) sites, where i have done this in the past, i get the expected output which looks something like:

Any help would be appreciated.

Kind Regards,



Morten Bengtson Dynamicweb Employee
Morten Bengtson
This post has been marked as an answer

Hi Joe,

Try to see if the following works for you:

app.UseStaticFiles(new StaticFileOptions
    FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot/.well-known")),
    RequestPath = new PathString("/.well-known"),
    ServeUnknownFileTypes = true

Alternatively, you can serve this by setting up a page with a single paragraph. You would have to use custom templates (without any html), set "Exact URL for this page" to ".well-known/apple-developer-merchantid-domain-association" and also change the content type to "text/plain" (or whatever the content-type should be). This approach also makes it easier to serve different well-known files on different websites (domains) in the same solution.


Votes for this answer: 1
Joseph Vause

Hi Morten,

Thankyou for your response. 

Thanks to your reply i managed to get this to work, however with a slight tweak.

Use of app.StaticFiles() does not work so i looked at your alternative approach.

For the next person who encounters such an issue, here are the steps i took:


1. Go to Assets > Templates > Designs > Swift and then create a new file called AppleDomainAssociation.cshtml

2. Paste the content of the static file you need to render into this (In my case what i was given from Stripe):

3. Go to Settings > Areas > Content > Item Types > Swift and create a new Item Type called 'Static page'

The settings are configuerd like this:

The Restrictions have been set like this:

4. Next, i went to Content > naviagation and created a new Page called 'AppleDomainAssociation' of the newly created Static Page Type

In the page settings for this i configured it pretty much as you suggested

Under General: No Theme selected

Under Layout: Choose the created template and set to text/plain

Under SEO, set the Exaclt URL for this page to the route i need:

Under Publication, set as published but not shown anywhere:

Save and close.

Now, when i head to that route in a browser, i get served the content i need, and it was successfully verified by stripe


Thanks so much for your reply as this guided me to solving this problem. Hopefully the steps above help someone else in the future!

Kind Regards,


Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars

>> Use of app.StaticFiles() does not work so i looked at your alternative approach.

Did you call the custom version of UseStaticFiles before you call UseDynamicWeb? Otherwise, DW's middleware loads first and takes over the path and return a 404 when it cannot find the file.

I can get it to work as follows (with Morten's code):


This solution may come in handy with dynamically generated files like certificate renew requests.




You must be logged in to post in the forum