码迷,mamicode.com
首页 > 其他好文 > 详细

Common 通用类库

时间:2015-08-31 01:02:03      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:

/// <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);
        }

 

Common 通用类库

标签:

原文地址:http://www.cnblogs.com/adolphyang/p/4772058.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!