/// <summary> /// 重写 URL 路径 /// </summary> /// <param name="uri">用户原始请求信息</param> /// <returns>重定向路径, 如果为空则不处理</returns> private string ReWriteURLPath(Uri uri) { BLL.WebSite bllsite = new BLL.WebSite(); string site_name = bllsite.MatchSiteName(uri.AbsolutePath); Model.WebSite modelsite = bllsite.GetModel(site_name); if (CheckData.IsObjectNull(modelsite)) { return(string.Empty); } BLL.URLReWriter bllurl = new BLL.URLReWriter(modelsite); Model.URLReWriter modelurl = bllurl.GetItem_RequestURI(uri.AbsolutePath); if (CheckData.IsObjectNull(modelurl)) { string resource_file = bllurl.GetResourceFilePath(uri.AbsolutePath, bllsite); string abs_resource_file = PathHelp.ToAbsolute(resource_file); if (File.Exists(abs_resource_file)) { return(resource_file); } // 当得到的对象 为空的时候,证明没有此数据内容,当然也就不用生成了 return(string.Empty); } FileInfo FItemp = new FileInfo(bllurl.GetFilePath_Templet(modelurl)); if (!FItemp.Exists) { // 模板文件都不存在的话,就不用生成了 return(string.Empty); } SystemConfig sys_config = GlobalSystemService.GetInstance().Config.Get <SystemConfig>(); FileInfo FItarget = new FileInfo(bllurl.GetFilePath_Target(modelurl)); if (sys_config.Is_DeBug || !FItarget.Exists || FItemp.LastWriteTime > FItarget.LastWriteTime) { // 生成模板 HtmlToAspx hta = new HtmlToAspx(); HtmlToAspx.Params par = hta.ParamsMerge(modelurl, FItemp, FItarget); hta.Generate(par); } return(bllurl.HTTPRedirectPath(uri, modelurl)); }
/// <summary> /// 获取资源文件地址 /// </summary> /// <param name="url_absolute_path">url绝对地址路径</param> /// <param name="bllwebsite">业务逻辑层: Web站点</param> /// <returns>得到的资源文件地址</returns> public string GetResourceFilePath(string url_absolute_path, BLL.WebSite bllwebsite) { string page = bllwebsite.MatchPagePath(url_absolute_path); return(string.Format("/{0}/{1}", this.SelfDAL.GetPathFolder(), page)); }