Hidden Features of ASP.NET [closed] Hidden Features of ASP.NET [closed] asp.net asp.net

Hidden Features of ASP.NET [closed]


While testing, you can have emails sent to a folder on your computer instead of an SMTP server. Put this in your web.config:

<system.net>    <mailSettings>        <smtp deliveryMethod="SpecifiedPickupDirectory">            <specifiedPickupDirectory pickupDirectoryLocation="c:\Temp\" />        </smtp>    </mailSettings></system.net>


If you place a file named app_offline.htmin the root of a web application directory, ASP.NET 2.0+ will shut-down the application and stop normal processing any new incoming requests for that application, showing only the contents of the app_offline.htm file for all new requests.

This is the quickest and easiest way to display your "Site Temporarily Unavailable" notice while re-deploying (or rolling back) changes to a Production server.

Also, as pointed out by marxidad, make sure you have at least 512 bytes of content within the file so IE6 will render it correctly.


throw new HttpException(404, "Article not found");

This will be caught by ASP.NET which will return the customErrors page. Learned about this one in a recent .NET Tip of the Day Post