/// <summary>
/// 传入虚拟路径 返回全路径的html字符串
/// </summary>
/// <param name="context">当前数据上下文</param>
/// <param name="virtualPath">虚拟路径</param>
/// <returns>返回全路径的html字符串</returns>
public static string GetHtmlFromVirtualPath(HttpContext context,string virtualPath)
{
string fileFullPath = context.Server.MapPath(virtualPath);
string html = File.ReadAllText(fileFullPath);
return html;
}
/// <summary>
/// 输出错误信息到错误界面
/// </summary>
/// <param name="context">当前数据上下文</param>
/// <param name="virtualPath">错误页面的 虚拟路径</param>
/// <param name="errormsg">错误信息</param>
private void OutputError(HttpContext context, string virtualPath,string errormsg)
{
string htmlError = GetHtmlFromVirtualPath(context, virtualPath);
string htmlNewError = htmlError.Replace("{errormsg}", errormsg);
context.Response.Write(htmlNewError);
}