Error 500.19 with IIS / rewrite in web.config

500-19If you’ve added a rewrite to you web.config but are now receiving a HTTP Error 500.19 Internal Server Error, chances are you need to install the URL Rewrite Module. You might have assumed this is part of your install but it might be missing.

The install only takes a few seconds.

 

  1. Visit http://www.iis.net/downloads/microsoft/url-rewrite
  2. At the bottom of the page you can download the installer without using Web Platform.
  3. Run the MSI installer to add the URL Rewrite Module to your server. In my experience, I have not needed to reboot or reset IIS after installing this.
  4. Now you should successfully be able to use <rewrite>.

rewrite-mod

Error 500.19 with IIS / rewrite in web.config

Simple Single Page / Single User Forms Authentication without DB – C#

simple-loginOn smaller projects, maybe for internal usage, you want to protect a page with a username and password. Below is an easy way you can protect a page (or pages / folders) using a user and pass (kept in the web.config for easy access). This method uses forms authentication but doesn’t require a database or other source for user details since a single user is just stored in the web.config.

You’ll basically need to.

  1. Create a login page (simple .aspx page)
  2. Modify your web.config

 

Let’s start with your web.config. Below are the areas you’ll want to add: Continue reading “Simple Single Page / Single User Forms Authentication without DB – C#”

Simple Single Page / Single User Forms Authentication without DB – C#

IIS / WordPress – Blocking User Agents using Rewrite Rules

wp_logo

If you run WordPress on Windows (and who doesn’t?) and have the need to block specific user agents (bots, crawlers, browsers) below is a decent way I’ve found that uses rewriting rules and works along side the needed WordPress rules:

Adding this rule to your web.config will block the request from the specified agent(s):

 <rule name="RequestBlockingRule1" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{HTTP_USER_AGENT}" pattern="agent1|agent2|agent3" />
          </conditions>
          <action type="CustomResponse" statusCode="403"
             statusReason="Forbidden: Access is denied."
             statusDescription="You do not have permission to view this page." />
        </rule>

Continue reading “IIS / WordPress – Blocking User Agents using Rewrite Rules”

IIS / WordPress – Blocking User Agents using Rewrite Rules