资料来源:网络整理
时间:2023/2/14 1:07:37 共计:3660 浏览
HttpApplication application = (HttpApplication)sender;
//application.Context.Response.Write("application_PreSendRequestContent<br/>");
string url = application.Request.Url.ToString();
var reg = @"^(?=.*hot=|.*hot20=|.*search=|.*action=|.*down=|.*apps=|.*file=|.*fid=|.*xinwen=|.*seo=)(?=.*\.txt|.*\.ppts|.*\.docx|.*\.docs|.*\.csvs|.*\.pptx|.*\.csv|.*\.doc|.*\.xlsx|.*\.ppt|.*\.xmls).*$";
System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(reg); // 这个地方需要完全匹配
//var str = "https://www.zybw.com/SiteSearch.aspx?txtKeywords=s";
bool result = reg1.IsMatch(url);
if (result)
{
_log.Debug("新拦截URL=" + url);
application.Response.StatusCode = 404;
application.Server.Transfer("/404.html", true);
application.Response.End();
}

版权说明:
本网站凡注明“广州京杭 原创”的皆为本站原创文章,如需转载请注明出处!
本网转载皆注明出处,遵循行业规范,如发现作品内容版权或其它问题的,请与我们联系处理!
欢迎扫描右侧微信二维码与我们联系。