【发布时间】:2010-10-15 04:41:39
【问题描述】:
我想确保在错误页面上没有任何不妥之处进入引荐来源网址。
为了验证 http 标头,我应该检查什么。
下面是我当前的代码:
// Ensure the referrer header is good
if (this.Request.UrlReferrer.IsWellFormedOriginalString() &&
this.Request.UrlReferrer.Host.Equals(this.Request.Url.Host))
{
这将导致使用 %3C 和 %3E 而不是 的 acunetix 扫描失败,因此我显然需要涵盖 html 编码 - 还有什么我遗漏的吗?
更新 我可以使用以下代码捕获所有 acunetix 扫描:
if (this.Request.UrlReferrer.IsWellFormedOriginalString() &&
this.Request.UrlReferrer.Host.Equals(this.Request.Url.Host) &&
!Regex.IsMatch(this.Request.UrlReferrer.ToString(),
"%3C",
RegexOptions.IgnoreCase))
{
【问题讨论】:
标签: asp.net validation referrer http-referer