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


C# Uri.ToExternalForm方法代码示例

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


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

示例1: 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.V(Log.TagSync, "FacebookAuthorizer looking up key: %s from list of access tokens"
             , key);
         return accessTokens.Get(key);
     }
     catch (Exception e)
     {
         Log.E(Log.TagSync, "Error looking up access token", e);
     }
     return null;
 }
开发者ID:jonlipsky,项目名称:couchbase-lite-net,代码行数:17,代码来源:FacebookAuthorizer.cs

示例2: AssertionForEmailAndSite

 public static string AssertionForEmailAndSite(string email, Uri site)
 {
     IList<string> key = new AList<string>();
     key.AddItem(email);
     key.AddItem(site.ToExternalForm().ToLower());
     Log.V(Log.TagSync, "PersonaAuthorizer looking up key: %s from list of assertions"
         , key);
     return assertions.Get(key);
 }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:9,代码来源:PersonaAuthorizer.cs

示例3: VerifyRemoteDocExists

 /// <summary>TODO: 1.</summary>
 /// <remarks>
 /// TODO: 1. refactor to use getRemoteDoc
 /// TODO: 2. can just make synchronous http call, no need for background task
 /// </remarks>
 /// <param name="remote"></param>
 /// <param name="doc1Id"></param>
 /// <exception cref="System.UriFormatException">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_445(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:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:30,代码来源:ReplicationTest.cs

示例4: 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(Log.TagSync, message, e);
             throw new ArgumentException(message, e);
         }
         return RegisterAssertion(assertion, email, origin);
     }
 }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:28,代码来源:PersonaAuthorizer.cs

示例5: GetRemoteDoc

 /// <exception cref="System.UriFormatException"></exception>
 /// <exception cref="System.IO.IOException"></exception>
 private HttpResponse GetRemoteDoc(Uri pathToDoc)
 {
     HttpClient httpclient = new DefaultHttpClient();
     HttpResponse response = null;
     string responseString = null;
     response = httpclient.Execute(new HttpGet(pathToDoc.ToExternalForm()));
     StatusLine statusLine = response.GetStatusLine();
     if (statusLine.GetStatusCode() != HttpStatus.ScOk)
     {
         throw new RuntimeException("Did not get 200 status doing GET to URL: " + pathToDoc
             );
     }
     return response;
 }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:16,代码来源:ReplicationTest.cs


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