0

Currently my web.config file has this:

<system.web>
    <httpCookies httpOnlyCookies="true" requireSSL="true" />
</system.web>

I want requireSSL to be "true" in release and "false" in debug. How do I do this?

nmit026
  • 3,024
  • 2
  • 27
  • 53

3 Answers3

0

Web.config does not support conditional statements.

This is typically handled in deployment. You can use transformation files. https://msdn.microsoft.com/en-us/library/dd465318(v=vs.100).aspx

0

Put this in your Web.Release.config file:

<httpCookies requireSSL="true" xdt:Transform="SetAttributes(requireSSL)"/>

Here's a handy tool from AppHarbor for testing the results of your transformations: https://webconfigtransformationtester.apphb.com/

nmit026
  • 3,024
  • 2
  • 27
  • 53
0

I think this is something you are looking for

Web.Config Debug/Release

Please check this one

xdt:Transform="SetAttributes" xdt:Locator="Match(name)"