Customize web.config

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
selwonk
User
Posts: 5

Customize web.config

Post by selwonk »

Hi.

Has anybody built an extension to allow customisation of web.config with ASP .NET Maker projects?

I'd like to implement CSP (Content Security Policy) which requires the addition of custom headers in the web.config file but, naturally, this file is overwritten when publishing the project.

Thanks in advance.

MK


MichaelG
User
Posts: 1095

Post by MichaelG »

There are many ways to customize the web.config:

  1. To avoid overwriting your custom web.config, uncheck Generate -> Clear project folder first and also uncheck the web.config file in the Generate dialog during generation.
  2. Make an extension to replace or modify the web.config, see Making Extensions.
  3. Use EndGenerate event to modify the generated web.config. You can load the file as text file, or you can use xml-js (which is included in ASP.NET Maker node modules) to load the file as XML and then modify.

selwonk
User
Posts: 5

Post by selwonk »

Ah!

I hadn't realised you could exclude web.config in the build. That solves my problem entirely!

Thanks very much indeed.


Post Reply