/BlogEngine/BlogEngine.NET/error.aspx.cs

# · C# · 34 lines · 30 code · 4 blank · 0 comment · 3 complexity · 6e8003477f600d5051de5efdc52bbc53 MD5 · raw file

  1. using System;
  2. using System.Web;
  3. using System.Web.UI;
  4. using System.Web.UI.WebControls;
  5. using System.Web.UI.HtmlControls;
  6. using BlogEngine.Core.Web.Controls;
  7. using BlogEngine.Core;
  8. using System.Collections.Generic;
  9. public partial class error_occurred : BlogBasePage
  10. {
  11. protected void Page_Load(object sender, EventArgs e)
  12. {
  13. Page.Title = Resources.labels.Error;
  14. OutputErrorDetails();
  15. }
  16. private void OutputErrorDetails()
  17. {
  18. string contextItemKey = "LastErrorDetails";
  19. if (Security.IsAuthorizedTo(Rights.ViewDetailedErrorMessages) && HttpContext.Current.Items.Contains(contextItemKey))
  20. {
  21. string errorDetails = (string)HttpContext.Current.Items[contextItemKey];
  22. if (!string.IsNullOrEmpty(errorDetails))
  23. {
  24. divErrorDetails.Visible = true;
  25. pDetails.InnerHtml = Server.HtmlEncode(errorDetails);
  26. pDetails.InnerHtml = errorDetails.Replace(Environment.NewLine, "<br /><br />");
  27. }
  28. }
  29. }
  30. }