What are the hidden features of Asp.Net?

There are always features that would be useful in fringe scenarios, but for that very reason most people don't know them.

What are the ones that you know?

Summary of Answers: Here's a list based on the answers put in by everyone so far:

  • Use of HttpContext.Items for caching request level items.
  • Using HttpContext.IsCustomErrorEnabled
  • Use of HttpModules.
  • Enabling Trace from code based on QueryString Parameters and using Single Code Behinds for multiple ASPX Pages: Link to answer for code samples
  • For testing, you can send emails to a folder rather than a SMTP server with a simple change in the web.config: Link to answer for code sample
  • In ASP.Net 3.5 SP1, customErrors has a redirectMode attribute which allows showing error pages without changing the URL. Also, the form tag now recognizes the action attribute. Great for when you're using URL rewriting.
  • Setting Server Control Properties based on Target Browser: article
  • you can put an asp.net app offline simply by placing a file called app_offline.htm in the root. All new requests redirect to this file.
  • you can throw an HttpException which will be caught by Asp.Net and the corresponding customError Page will be shown. Link to answer for code sample

Read more...

 

1 Comment

  • Bummer, it's too bad using Single Code Behinds for multipel pages doesn't actually work. There doesn't appear to be any namespace for actual web projects in this capacity.

    That would have been kick ass if .NET were capable of this. If you have a work around I would love to hear it but as it stands now this should be delete from the list. I enjoyed the rest of the tips though!

    Thom

Comments have been disabled for this content.