當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。