Developer forum

Forum » Templates » How do I disable the &debug=true?

How do I disable the &debug=true?

Sten Hougaard
Reply

Hi,

I would like to be able to disable the "debug=true" feature on a solution - how do I do it? Web.config? 

 

 

Med venlig hilsen / Kind regards

 

Sten Hougaard

Webdeveloper

727 Online as 

www.727.dk

 


Replies

 
Nicolai Høeg Pedersen
Reply

You cannot right now.

 

We've been asked to find a solution to this so it requires that you either enable it or is logged into the backend.

 

BR Nicolai

 
Morten Bengtson
Reply

Here are two web.config workarounds (there are probably other ways to do it)

A) Return a 404

If request filtering is enabled in IIS then you can add something like the following to web.config:

<system.webServer>
   <security>
      <requestFiltering>
         <denyQueryStringSequences>
            <add sequence="debug=true" />
         </denyQueryStringSequences>
      </requestFiltering>
   </security>
</system.webServer>

B) Redirect
If you are able to install the URL Rewrite module in IIS then you can define a rewrite rule that makes a redirect to the same URL without debug=true

<system.webServer>
	<rewrite>
            <rules>
                <rule name="DebugDisabler" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Redirect" url="{R:1}?{C:1}{C:2}" appendQueryString="false" redirectType="Permanent" />
                    <conditions>
                        <add input="{QUERY_STRING}" pattern="(.*)debug=true[&amp;]?(.*)" />
                    </conditions>
                </rule>
            </rules>
        </rewrite>
</system.webServer>

 

 

You must be logged in to post in the forum