当前位置: 首页>>代码示例>>C#>>正文


C# HttpRequest.GetFullUrl方法代码示例

本文整理汇总了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;

		}
开发者ID:OndrejValenta,项目名称:prerender.io.mvc6,代码行数:46,代码来源:WebRequestHelper.cs

示例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);
		}
开发者ID:OndrejValenta,项目名称:prerender.io.mvc6,代码行数:23,代码来源:WebRequestHelper.cs


注:本文中的HttpRequest.GetFullUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。