ProAnswers.org

Hidden Features of ASP.NET

I am asking for features that are not typically taught by the text books.

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





     deliveryMethod="SpecifiedPickupDirectory">
         pickupDirectoryLocation="c:\Temp\" />
  • 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](http://dotnettipoftheday.org/tips/how-to-respond-with-code-404-not-found-in-aspnet.aspx?discussion=1)
    
    • If you place a file named app_offline.htm in 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.