Tuesday, 20 September 2011

Correctly clearing HttpRuntime.Cache after Global Application_Error handling

In Global.asax i have code in Application Error handler which stores the error message in Cache, logs the error to the application log file and then Transfers the user over to the Error.aspx page to display the message within the website template/theme.

What i want to know is if there is a good way to manage the Cache content.

Currently, i am setting the Cache value with a key that is defined in globally available Constants file, and then explicitly removing it in the Error.aspx code behind.

Is there a smarter way to ensure that the Cache is cleaned up properly once the error handling is complete?

No comments:

Post a Comment