Web.UI/HttpModule.cs
(开头部分) 9KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading;
using System.Web;
using System.Configuration;
using System.Xml;
using Common;
namespace Web.UI
{
/// <summary>
/// Ubuy的HttpModule类
/// </summary>
public class HttpModule : System.Web.IHttpModule
{
/// <summary>
/// 实现接口的Init方法
/// </summary>
/// <param name="context"></param>
public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(KillSqlFilter);
context.BeginRequest += new EventHandler(ReUrl_BeginRequest);
}
/// <summary>
/// 实现接口的Dispose方法
/// </summary>
public void Dispose()
{
}
#region 过滤SQL注入危险字符
/// <summary>
/// 过滤SQL注入危险字符
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void KillSqlFilter(object sender, EventArgs e)
{
HttpContext context = ((HttpApplication)sender).Context;
Model.WebSet SiteConfig = new BLL.WebSet().loadConfig(Utils.GetXmlMapPath("Configpath"));
string killSqlFilter = SiteConfig.WebKillKeywords; //获取需要过滤的危险字符集
//排除不需要过滤的目录
bool isKill = true;
string notKillPath = SiteConfig.WebManagePath + "|KindEditor"; //排除的目录列表
string[] arrNotKillPath = notKillPath.Split('|');
//取得发出请求的页面
if (context.Request.UrlReferrer != null)
{
foreach (string str in arrNotKillPath)
{
if (context.Request.UrlReferrer.ToString().ToLower().IndexOf(SiteConfig.WebPath + str.ToLower() + "/") > 0)
{
isKill = false;
}
}
}
后面还有 222 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。