我的asp.net网站允许用户从app_themes文件夹生成的列表中选择他们想要的主题。不时,主题被重新命名或删除。谁选择了删除的主题名称(它被存储在cookie中)的任何用户将得到异常:主题'XXX'无法在应用程序或全局主题目录中找到
Theme 'XXX' cannot be found in the application or global theme directories
Stack Trace:
[HttpException (0x80004005): Theme 'test' cannot be found in the application or global theme directories.]
System.Web.Compilation.ThemeDirectoryCompiler.GetThemeBuildResultType(String themeName) +920
System.Web.Compilation.ThemeDirectoryCompiler.GetThemeBuildResultType(HttpContext context, String themeName) +73
System.Web.UI.Page.InitializeThemes() +8699455
System.Web.UI.Page.PerformPreInit() +38
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +282
哪里是陷阱的最好的地方和处理这个异常?
你是说它不可能发现这个异常? – simon831 2009-06-29 10:32:51
当然没有。您可以随时处理Global.asax中的Application_OnError。 – 2009-06-29 12:30:28