IA.Common/AntiForgery/Validation.cs
(完整代码) 1KB// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;
using System.Web;
using Microsoft.Web.Infrastructure.DynamicValidationHelper;
namespace IA.Common.AntiForgery
{
public static class Validation
{
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "request",
Justification =
"Parameter is only meant for making this show up as 'Request.Unvalidated()', which closely resembles FX45 syntax."
)]
public static UnvalidatedRequestValues Unvalidated(this HttpRequestBase request)
{
return Unvalidated((HttpRequest) null);
}
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "request",
Justification =
"Parameter is only meant for making this show up as 'Request.Unvalidated()', which closely resembles FX45 syntax."
)]
public static UnvalidatedRequestValues Unvalidated(this HttpRequest request)
{
// We don't actually need the request object; we'll get HttpContext.Current directly.
HttpContext context = HttpContext.Current;
Func<NameValueCollection> formGetter;
Func<NameValueCollection> queryStringGetter;
ValidationUtility.GetUnvalidatedCollections(context, out formGetter, out queryStringGetter);
return new UnvalidatedRequestValues(new HttpRequestWrapper(context.Request), formGetter, queryStringGetter);
}
public static string Unvalidated(this HttpRequestBase request, string key)
{
return Unvalidated(request)[key];
}
public static string Unvalidated(this HttpRequest request, string key)
{
return Unvalidated(request)[key];
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
