本文整理汇总了C#中System.UriBuilder.EditQueryArgument方法的典型用法代码示例。如果您正苦于以下问题:C# UriBuilder.EditQueryArgument方法的具体用法?C# UriBuilder.EditQueryArgument怎么用?C# UriBuilder.EditQueryArgument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.UriBuilder
的用法示例。
在下文中一共展示了UriBuilder.EditQueryArgument方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateEtag
public bool UpdateEtag(HttpResponseBase response, Uri uri, string etag)
{
var newLocation = new UriBuilder(uri);
newLocation.EditQueryArgument(UrlEtagQuerystringName, etag);
HttpResponseHeaderHelper.SetContentLocation(response, newLocation.Uri);
return false;
}
示例2: UpdateEtag
public bool UpdateEtag(HttpResponseBase response, Uri uri, string etag)
{
var newLocation = new UriBuilder(uri);
newLocation.EditQueryArgument(UrlEtagQuerystringName, etag);
HttpResponseHeaderHelper.SetTemporaryRedirect(response, newLocation.Uri);
return true;
}
示例3: GetUrlEtagHandler
/// <summary>
/// The url etag handler to use.
/// </summary>
/// <param name="request">An HTTP request.</param>
/// <param name="response">An HTTP response.</param>
/// <param name="urlEtagHandlingMethod">The url etag handler method to use.</param>
/// <param name="urlEtagQuerystringName">The querystring parameter name that contains the url etag.</param>
/// <param name="etag">The etag the url etag should match.</param>
/// <returns></returns>
protected IUrlEtagHandler GetUrlEtagHandler(HttpRequestBase request, HttpResponseBase response, UrlEtagHandlingMethodType urlEtagHandlingMethod, string urlEtagQuerystringName, string etag)
{
if (urlEtagHandlingMethod == UrlEtagHandlingMethodType.None || !HttpRequestHeaderHelper.HasQuerystringParameter(request, urlEtagQuerystringName))
{
return null;
}
var urlEtag = HttpRequestHeaderHelper.GetQuerystringParameterValue(request, urlEtagQuerystringName);
if (urlEtag == etag)
{
return null;
}
var newLocation = new UriBuilder(request.Url);
newLocation.EditQueryArgument(urlEtagQuerystringName, etag);
switch (urlEtagHandlingMethod)
{
case UrlEtagHandlingMethodType.ContentLocation:
return new UrlEtagHandlerContentLocation(HttpResponseHeaderHelper, urlEtagQuerystringName);
case UrlEtagHandlingMethodType.MovedPermanently:
return new UrlEtagHandlerMovedPermanently(HttpResponseHeaderHelper, urlEtagQuerystringName);
case UrlEtagHandlingMethodType.TemporaryRedirect:
return new UrlEtagHandlerTemporaryRedirect(HttpResponseHeaderHelper, urlEtagQuerystringName);
default:
return null;
}
}