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


C# Url.GetQuery方法代码示例

本文整理汇总了C#中N2.Web.Url.GetQuery方法的典型用法代码示例。如果您正苦于以下问题:C# Url.GetQuery方法的具体用法?C# Url.GetQuery怎么用?C# Url.GetQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在N2.Web.Url的用法示例。


在下文中一共展示了Url.GetQuery方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResolveUrl

        public virtual PathData ResolveUrl(Url url)
        {
            try
            {
                var path = parser.FindPath(url.RemoveDefaultDocument(Url.DefaultDocument).RemoveExtension(observedExtensions));

                path.CurrentItem = path.CurrentPage;

                if (draftRepository.Versions.TryParseVersion(url[PathData.VersionIndexQueryKey], url[PathData.VersionKeyQueryKey], path))
                    return path;

                string viewPreferenceParameter = url.GetQuery(WebExtensions.ViewPreferenceQueryString);
                if (viewPreferenceParameter == WebExtensions.DraftQueryValue && draftRepository.HasDraft(path.CurrentItem))
                {
                    var draft = draftRepository.Versions.GetVersion(path.CurrentPage);
					path.TryApplyVersion(draft, url["versionKey"], draftRepository.Versions);
                }

                return path;
            }
            catch (Exception ex)
            {
                errorHandler.Notify(ex);
            }
            return PathData.Empty;
        }
开发者ID:Biswo,项目名称:n2cms,代码行数:26,代码来源:RequestPathProvider.cs

示例2: ResolveUrl

		public virtual PathData ResolveUrl(Url url)
		{
            // simple cache to help with multiple requests for same URL - PoC
		    if ((lastUrl != null) && (lastUrl.Item1 == url.ToString()))
		    {
		        var result = lastUrl.Item2;
		        lastUrl = null;
		        return result;
		    }

			try
			{
				var path = parser.FindPath(url.RemoveDefaultDocument(Url.DefaultDocument).RemoveExtension(observedExtensions));

				path.CurrentItem = path.CurrentPage;

				if (draftRepository.Versions.TryParseVersion(url[PathData.VersionIndexQueryKey], url["versionKey"], path))
				{
				    lastUrl = new Tuple<string, PathData>(url, path);
                    return path;
                }

				string viewPreferenceParameter = url.GetQuery(WebExtensions.ViewPreferenceQueryString);
				if (viewPreferenceParameter == WebExtensions.DraftQueryValue && draftRepository.HasDraft(path.CurrentItem))
				{
					var draft = draftRepository.Versions.GetVersion(path.CurrentPage);
					path.TryApplyVersion(draft, url["versionKey"]);
				}

                lastUrl = new Tuple<string, PathData>(url, path);
				return path;
			}
			catch (Exception ex)
			{
				errorHandler.Notify(ex);
			}
			return PathData.Empty;
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:38,代码来源:RequestPathProvider.cs

示例3: Getting_Query_WhenNoQueries_GivesNull

 public void Getting_Query_WhenNoQueries_GivesNull()
 {
     Url u = new Url("/hello.aspx");
     var q = u.GetQuery("something");
     Assert.That(q, Is.Null);
 }
开发者ID:rohancragg,项目名称:n2cms,代码行数:6,代码来源:UrlTests.cs

示例4: Getting_NonExistantQuery_GivesNull

 public void Getting_NonExistantQuery_GivesNull()
 {
     Url u = new Url("/hello.aspx?something=someotherthing");
     var q = u.GetQuery("nothing");
     Assert.That(q, Is.Null);
 }
开发者ID:rohancragg,项目名称:n2cms,代码行数:6,代码来源:UrlTests.cs

示例5: CanGet_Query

 public void CanGet_Query()
 {
     Url u = new Url("/hello.aspx?something=someotherthing");
     var q = u.GetQuery("something");
     Assert.That(q, Is.EqualTo("someotherthing"));
 }
开发者ID:rohancragg,项目名称:n2cms,代码行数:6,代码来源:UrlTests.cs

示例6: IsObservable

		public virtual bool IsObservable(Url url)
		{
			if (observeAllExtensions)
				return true;

			if(url.LocalUrl == Url.ApplicationPath)
				return true;

			string extension = url.Extension;
			if (rewriteEmptyExtension && string.IsNullOrEmpty(extension))
				return true;
			foreach (string observed in observedExtensions)
				if (string.Equals(observed, extension, StringComparison.InvariantCultureIgnoreCase))
					return true;
			if (url.GetQuery(PathData.PageQueryKey) != null)
				return true;

			return false;
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:19,代码来源:RequestPathProvider.cs


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