📄 peexceptionmodule.cs
字号:
namespace PowerEasy.Components
{
using PowerEasy.Enumerations;
using System;
using System.Web;
public class PEExceptionModule : IPEModule
{
public void Init(PEApplication pea)
{
if (pea != null)
{
pea.CustomException += new PEExceptionEventHandler(this.pea_CustomException);
}
}
private void pea_CustomException(CustomException ex, EventArgs e)
{
RedirectToMessage(ex);
}
private static void RedirectToMessage(CustomException exception)
{
HttpContext current = HttpContext.Current;
string path = "/Prompt/ShowError.aspx";
string url = "/Prompt/ShowExceptionMessage.aspx?MessageID=" + ((int) exception.ExceptionType).ToString();
string manageDir = SiteConfig.SiteOption.ManageDir;
if (current.Request.Url.AbsolutePath.ToLower().Contains(manageDir.ToLower()))
{
path = "~/" + manageDir + path;
url = "~/" + manageDir + url;
}
else
{
path = "~" + path;
url = "~" + url;
}
if (exception.ExceptionType == PEExceptionType.BllError)
{
current.Items["ErrorMessage"] = exception.Message;
current.Server.Transfer(path, true);
}
else
{
current.Response.Redirect(url, true);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -