當前位置: 首頁>>代碼示例>>C#>>正文


C# Uri.ToExternalForm方法代碼示例

本文整理匯總了C#中System.Uri.ToExternalForm方法的典型用法代碼示例。如果您正苦於以下問題:C# Uri.ToExternalForm方法的具體用法?C# Uri.ToExternalForm怎麽用?C# Uri.ToExternalForm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Uri的用法示例。


在下文中一共展示了Uri.ToExternalForm方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AssertionForEmailAndSite

		public static string AssertionForEmailAndSite(string email, Uri site)
		{
			IList<string> key = new AList<string>();
			key.AddItem(email);
			key.AddItem(site.ToExternalForm().ToLower());
			Log.D(Database.Tag, "PersonaAuthorizer looking up key: " + key + " from list of assertions"
				);
			return assertions.Get(key);
		}
開發者ID:Redth,項目名稱:couchbase-lite-net,代碼行數:9,代碼來源:PersonaAuthorizer.cs

示例2: AccessTokenForEmailAndSite

		public static string AccessTokenForEmailAndSite(string email, Uri site)
		{
			try
			{
				IList<string> key = new AList<string>();
				key.AddItem(email);
				key.AddItem(site.ToExternalForm().ToLower());
				Log.D(Database.Tag, "FacebookAuthorizer looking up key: " + key + " from list of access tokens"
					);
				return accessTokens.Get(key);
			}
			catch (Exception e)
			{
				Log.E(Database.Tag, "Error looking up access token", e);
			}
			return null;
		}
開發者ID:Redth,項目名稱:couchbase-lite-net,代碼行數:17,代碼來源:FacebookAuthorizer.cs

示例3: RegisterAssertion

		public static string RegisterAssertion(string assertion)
		{
			lock (typeof(PersonaAuthorizer))
			{
				string email;
				string origin;
				IDictionary<string, object> result = ParseAssertion(assertion);
				email = (string)result.Get(AssertionFieldEmail);
				origin = (string)result.Get(AssertionFieldOrigin);
				// Normalize the origin URL string:
				try
				{
					Uri originURL = new Uri(origin);
					if (origin == null)
					{
						throw new ArgumentException("Invalid assertion, origin was null");
					}
					origin = originURL.ToExternalForm().ToLower();
				}
				catch (UriFormatException e)
				{
					string message = "Error registering assertion: " + assertion;
					Log.E(Database.Tag, message, e);
					throw new ArgumentException(message, e);
				}
				return RegisterAssertion(assertion, email, origin);
			}
		}
開發者ID:Redth,項目名稱:couchbase-lite-net,代碼行數:28,代碼來源:PersonaAuthorizer.cs

示例4: VerifyRemoteDocExists

		/// <exception cref="System.UriFormatException"></exception>
		private void VerifyRemoteDocExists(Uri remote, string doc1Id)
		{
			Uri replicationUrlTrailing = new Uri(string.Format("%s/", remote.ToExternalForm()
				));
			Uri pathToDoc = new Uri(replicationUrlTrailing, doc1Id);
			Log.D(Tag, "Send http request to " + pathToDoc);
			CountDownLatch httpRequestDoneSignal = new CountDownLatch(1);
			BackgroundTask getDocTask = new _BackgroundTask_331(pathToDoc, doc1Id, httpRequestDoneSignal
				);
			//Closes the connection.
			getDocTask.Execute();
			Log.D(Tag, "Waiting for http request to finish");
			try
			{
				httpRequestDoneSignal.Await(300, TimeUnit.Seconds);
				Log.D(Tag, "http request finished");
			}
			catch (Exception e)
			{
				Sharpen.Runtime.PrintStackTrace(e);
			}
		}
開發者ID:Redth,項目名稱:couchbase-lite-net,代碼行數:23,代碼來源:ReplicationTest.cs


注:本文中的System.Uri.ToExternalForm方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。