本文整理汇总了C#中HttpRequest.GetFullUrl方法的典型用法代码示例。如果您正苦于以下问题:C# HttpRequest.GetFullUrl方法的具体用法?C# HttpRequest.GetFullUrl怎么用?C# HttpRequest.GetFullUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpRequest
的用法示例。
在下文中一共展示了HttpRequest.GetFullUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldShowPrerenderedPage
private bool ShouldShowPrerenderedPage(HttpRequest request)
{
var userAgent = request.GetUserAgent();
#warning Not sure about this implemetation
var referer = request.Headers.ContainsKey("Referer") ? request.Headers["Referer"] : string.Empty;
var url = request.GetFullUrl();
#warning Not sure what this is supposed to do
if (HasEscapedFragment(request))
{
return true;
}
if (userAgent.IsEmptyString())
{
return false;
}
if (!IsSearchRobot(userAgent))
{
return false;
}
if (IsInResources(url))
{
return false;
}
var whiteList = options.Whitelist;
if (whiteList != null && !IsInWhiteList(url, whiteList))
{
return false;
}
var blacklist = options.Blacklist;
if (blacklist != null && IsInBlackList(url, referer, blacklist))
{
return false;
}
return true;
}
示例2: GetApiUrl
private string GetApiUrl(HttpRequest request)
{
var url = request.GetFullUrl();
// Correct for HTTPS if that is what the request arrived at the load balancer as
// (AWS and some other load balancers hide the HTTPS from us as we terminate SSL at the load balancer!)
if (request.Headers.ContainsKey("X-Forwarded-Proto") && string.Equals(request.Headers["X-Forwarded-Proto"], "https", StringComparison.InvariantCultureIgnoreCase))
{
url = url.Replace("http", "https");
}
#warning Not sure what this was supposed to do
// // Remove the application from the URL
// if (options.StripApplicationNameFromRequestUrl && !string.IsNullOrEmpty(request.ApplicationPath) && request.ApplicationPath != "/")
// {
// // http://test.com/MyApp/?_escape_=/somewhere
// url = url.Replace(request.ApplicationPath, string.Empty);
// }
var prerenderServiceUrl = options.PrerenderServiceUrl;
return prerenderServiceUrl.EndsWith("/")
? (prerenderServiceUrl + url)
: "{0}/{1}".Fill(prerenderServiceUrl, url);
}