getButterfly Logo getButterfly

While recently working on an ASP.NET site, I had to test some changes on the live site. Normally, I would use a staging server, but with no access to the real server, I had to resort to checking for a URL parameter.

The site uses ASP.NET Razor syntax, so here’s the code I used:

    if (Request.QueryString["c"] != null) {
        var cdebug = Request.QueryString["c"];
        if (int.Parse(cdebug) == 1) {
            // test code here

I can place anything where // test code here is, be it HTML, JS or CSS code.

Subscribe to getButterfly Blog

Once a week or so we send an email with our best content. We never bug you, we just send you our latest piece of content.

If you found any value in this post, agree, disagree, or have anything to add - please do. I use comments as my #1 signal for what to write about. Read our comment policy before commenting! Comments such as "Thank you!", "Awesome!", "You're the man!" are either marked as spam or stripped from URL.

Leave a Reply

Your email address will not be published. Required fields are marked *