Raise 404 on .aspx pages
<p>I have a ASP.NET 4.0 web forms application (IIS 7) where I am using URL routing to allow friendly URLs.  For example, instead of <code>Blog.aspx?title=the-blog-title</code>, I allow <code>Blog/the-blog-title</code>.</p>

<p>My question is:  How do I prevent users from directly accessing Blog.aspx?  I have included the following setting in my web.config:</p>

<pre><code>&lt;httpHandlers&gt;
  &lt;add verb="*" path="*.aspx" type="System.Web.HttpForbiddenHandler" /&gt;
&lt;/httpHandlers&gt;
</code></pre>

<p>This works, but it shows a 'This type of page is not served' error.  Is it possible to simply display a 404 error for all .aspx page requests using IIS or web.config?  (I know how to do this programatically, but I would prefer to use a config file if possible.)</p>
