1
マルチサイト/マルチ言語用に500エラーページを実装したいと考えています。私はthis articleに従っています。500カスタムエラーページ
ただし、Global.asaxのApplication_Error
は発砲していません。ここに私のコードは次のとおりです。
<%@ Application Language='C#' Inherits="Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.WindsorApplication" %>
<script RunAt="server">
private void Application_Error(object sender, EventArgs e)
{
var customErrorsSection = (System.Web.Configuration.CustomErrorsSection)ConfigurationManager.GetSection("system.web/customErrors");
var lastException = Server.GetLastError();
if (customErrorsSection.Mode != System.Web.Configuration.CustomErrorsMode.Off)
{
try
{
// Log.Error("There was an error in the application", lastException);
Server.ClearError();
HttpContext.Current.Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
Server.Transfer(string.Format("/Error/{0}_500.html", GetSafeLanguage()));
}
catch
{
}
}
}
private string GetSafeLanguage()
{
try
{
return Sitecore.Context.Language.CultureInfo.TwoLetterISOLanguageName;
}
catch
{
}
return string.Empty;
}
</script>
私はこれらの潜在的な問題を見ることができます:1) 'RunAt'はspelでなければなりません'runat'として導かれた。 2) 'WindsorApplication'クラスが' System.Web.HttpApplication'を継承していることを確認してください。 3)Global.asax.cs内のメソッドに、Global.asaxの '