private void Application_BeginRequest(object source, EventArgs e) { this.currentApplicationType = HiConfiguration.GetConfig().AppLocation.CurrentApplicationType; HttpApplication application = (HttpApplication)source; HttpContext context = application.Context; if (context.Request.RawUrl.IndexOfAny(new char[] { '<', '>', '\'', '"' }) != -1) { context.Response.Redirect(context.Request.RawUrl.Replace("<", "%3c").Replace(">", "%3e").Replace("'", "%27").Replace("\"", "%22"), false); } else { this.CheckInstall(context); if (this.currentApplicationType != ApplicationType.Installer) { CheckSSL(HiConfiguration.GetConfig().SSL, context); HiContext.Create(context, new UrlReWriterDelegate(HiHttpModule.ReWriteUrl)); if (HiContext.Current.SiteSettings.IsDistributorSettings && !((!HiContext.Current.SiteSettings.Disabled || (this.currentApplicationType != ApplicationType.Common)) || urlReg.IsMatch(context.Request.Url.AbsolutePath))) { context.Response.Write("站点维护中,暂停访问!"); context.Response.End(); } } } }
/// <summary> /// 网站模块入口 /// </summary> /// <param name="source"></param> /// <param name="e"></param> void Application_BeginRequest(object source, EventArgs e) { currentApplicationType = HiConfiguration.GetConfig().AppLocation.CurrentApplicationType; HttpApplication application = (HttpApplication)source; HttpContext context = application.Context; if (context.Request.RawUrl.IndexOfAny(new char[] { '<', '>', '\'', '"' }) != -1) { context.Response.Redirect(context.Request.RawUrl.Replace("<", "%3c").Replace(">", "%3e").Replace("'", "%27").Replace("\"", "%22"), false); } else { //检查是否已经安装了网站 CheckInstall(context); if (currentApplicationType != ApplicationType.Installer) { //后台域名验证 if (currentApplicationType == ApplicationType.Admin && string.Compare(Globals.DomainName, HiContext.Current.SiteSettings.SiteUrl, true) != 0) { context.Response.Redirect(Globals.GetSiteUrls().Home, true); } else { CheckSSL(HiConfiguration.GetConfig().SSL, context); HiContext.Create(context, new UrlReWriterDelegate(HiHttpModule.ReWriteUrl)); if (HiContext.Current.SiteSettings.IsDistributorSettings) { if (!((!HiContext.Current.SiteSettings.Disabled || (currentApplicationType != ApplicationType.Common)) || urlReg.IsMatch(context.Request.Url.AbsolutePath))) { context.Response.Write("站点维护中,暂停访问!"); context.Response.End(); } else if (currentApplicationType == ApplicationType.Admin) { context.Response.Redirect(Globals.GetSiteUrls().Home, false); } } } } } }
private void method_1(object sender, System.EventArgs e) { this.applicationType_0 = HiConfiguration.GetConfig().AppLocation.CurrentApplicationType; HttpApplication httpApplication = (HttpApplication)sender; HttpContext context = httpApplication.Context; if (context.Request.RawUrl.IndexOfAny(new char[] { '<', '>', '\'', '"' }) != -1) { context.Response.Redirect(context.Request.RawUrl.Replace("<", "%3c").Replace(">", "%3e").Replace("'", "%27").Replace("\"", "%22"), false); return; } this.method_2(context); if (this.applicationType_0 != ApplicationType.Installer) { if (this.applicationType_0 == ApplicationType.Admin && string.Compare(Globals.DomainName, "localhost", true) != 0 && string.Compare(Globals.DomainName, HiContext.Current.SiteSettings.SiteUrl, true) != 0) { context.Response.Redirect(Globals.GetSiteUrls().Home, true); return; } HiHttpModule.smethod_0(HiConfiguration.GetConfig().SSL, context); HiContext.Create(context, new UrlReWriterDelegate(HiHttpModule.smethod_1)); if (HiContext.Current.SiteSettings.IsDistributorSettings) { if (HiContext.Current.SiteSettings.Disabled && this.applicationType_0 == ApplicationType.Common && !HiHttpModule.regex_0.IsMatch(context.Request.Url.AbsolutePath)) { context.Response.Write("站点维护中,暂停访问!"); context.Response.End(); return; } if (this.applicationType_0 == ApplicationType.Admin) { context.Response.Redirect(Globals.GetSiteUrls().Home, false); } } } }
private void Application_BeginRequest(object source, EventArgs e) { this.currentApplicationType = HiConfiguration.GetConfig().AppLocation.CurrentApplicationType; HttpApplication application = (HttpApplication)source; HttpContext context = application.Context; if (context.Request.RawUrl.IndexOfAny(new char[] { '<', '>', '\'', '"' }) != -1) { context.Response.Redirect(context.Request.RawUrl.Replace("<", "%3c").Replace(">", "%3e").Replace("'", "%27").Replace("\"", "%22"), false); } else { this.CheckInstall(context); if (this.currentApplicationType != ApplicationType.Installer) { CheckSSL(HiConfiguration.GetConfig().SSL, context); HiContext.Create(context, new UrlReWriterDelegate(HiHttpModule.ReWriteUrl)); } } }
public static HiContext Create(HttpContext context) { return(HiContext.Create(context, false)); }