Want to follow this site? Here's the RSS feed.

Fundamentals of Themelia - Access Denial

Thursday, August 7, 2008

This documentation has been updated for Themelia Framework 2.0 Beta 5.

In addition to what you may think of as "positive" routing where routing goes to a living place, Themelia also provides "negative" routing with its access denial feature.  By using this simple feature you can block certain IP addresses, user agents, or HTTP referrers.  You may send them to a page with a simple message or forward them to another location.

Access denials are in the accessDenial collection and require a denial type, text, and either a message or target.  Here's an example of a very simple IP address denial:

<themelia.web>
  <webDomains>
    <add>
      <accessDenials>
        <add name="localBlock" type="address" text="127.0.0.1" message="Your IP address has been blocked" target="" enabled="true" />
      </accessDenials>
    </add>
  </webDomains>
</themelia.web>

This denial does nothing more than blocks your local host from seeing the web site at all.  If you were to look at any part of the web site from your local host IP address, you would see a simple message saying "Your IP address has been blocked".  If you have a target set, you will simply be redirected to that link.  If both a target and a message is set, the target takes precedence.

The following access denial demonstrates shows how you can use the target attribute to send people away:

<themelia.web>
  <webDomains>
    <add>
      <accessDenials>
        <add name="ie6Denial" type="useragent" text="MSIE 6.0" message="You're fired." target="http://www.getfirefox.com/" enabled="true" />
      </accessDenials>
    </add>
  </webDomains>
</themelia.web>

For example, if a particular forum post is constantly sending you people who wish to do nothing but write YouTube (a.k.a. bathroom wall) style comments on your blog, you can tell them to go away.  Or, better yet, send them away.  When the immature people stop expressing their extreme personal insecurities, you can either delete the entry or disable that entry by setting the enabled attribute to false.

You may also use the priority attribute (1, highest to 10, lowest) on an access denial to change the order in which the denials match the URL.  Logically, you should make sure that you're more specific or more important ones are at the topic.

Lastly, It's also important to note that access denials run before anything else in your Themelia pipeline.  Preprocessors won't even run.  So keep that in mind when using these denials.

Links

Creative Commons License
This work is licensed under a Creative Commons Attribution 2.5 License.

Powered by the Minima Blog Engine 3.1 and Squid Micro-Blogging Library.

Built on Themelia Framework 2.0

Developed using NetFXHarmonics DevServer 1.1.

(all of which are NetFXHarmonics products created by David Betz)

Mini-icons are part of the Silk Icons set of icons at famfamfam.com