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


C# Uri.IsWellFormedOriginalString方法代码示例

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


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

示例1: IsWellFormedOriginalString

        protected internal virtual bool IsWellFormedOriginalString(Uri uri)
        {
            // well formed according to RFC2396 and RFC2732
            // see Uri.IsWellFormedOriginalString for some docs

            // Though this class does not seem to do anything. Even null arguments aren't checked :/
            return uri.IsWellFormedOriginalString();
        }
开发者ID:T-REX-XP,项目名称:serialwifi,代码行数:8,代码来源:UriParser.cs

示例2: URLValidator_ServerValidate

 protected void URLValidator_ServerValidate(object source, ServerValidateEventArgs args)
 {
     args.IsValid = false;
     TextBox URLTextBox = AdFormView.FindControl("URLTextBox") as TextBox;
     if (URLTextBox != null && !URLTextBox.Text.Equals(String.Empty))
     {
         try
         {
             Uri uri = new Uri(URLTextBox.Text);
             if (uri.IsWellFormedOriginalString() &
                 (uri.Scheme == "http" | uri.Scheme == "https"))
             {
                 args.IsValid = true;
             }
         }
         catch
         {
         }
     }
     else
     {
         // Empty URL is okay.
         args.IsValid = true;
     }
 }
开发者ID:PratikPramanik,项目名称:labdms,代码行数:25,代码来源:EditAd.aspx.cs

示例3: TestIsWellFormedOriginalString

    public static void TestIsWellFormedOriginalString()
    {
        Uri uri;
        bool b;

        uri = new Uri("http://www.contoso.com/path?name");
        b = uri.IsWellFormedOriginalString();
        Assert.True(b);

        uri = new Uri("http://www.contoso.com/path???/file name");
        b = uri.IsWellFormedOriginalString();
        Assert.False(b);

        uri = new Uri(@"c:\\directory\filename");
        b = uri.IsWellFormedOriginalString();
        Assert.False(b);

        uri = new Uri(@"file://c:/directory/filename");
        b = uri.IsWellFormedOriginalString();
        Assert.False(b);

        uri = new Uri(@"http:\\host/path/file");
        b = uri.IsWellFormedOriginalString();
        Assert.False(b);
    }
开发者ID:johnhhm,项目名称:corefx,代码行数:25,代码来源:Uri.cs

示例4: IsWellFormedOriginalString

 public void IsWellFormedOriginalString(string uriString, bool expected)
 {
     Uri uri = new Uri(uriString);
     Assert.Equal(expected, uri.IsWellFormedOriginalString());
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:5,代码来源:Uri.MethodsTests.cs


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