PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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

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