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


C# Uri.MakeAppLocalPath方法代码示例

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


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

示例1: Should_support_site_root_without_trailing_slash

        public void Should_support_site_root_without_trailing_slash()
        {
            // Given
            var uri = new Uri("http://host/");

            // When
            string result = uri.MakeAppLocalPath(new Uri("http://host"));

            // Then
            result.ShouldEqual("/");
        }
开发者ID:JulianRooze,项目名称:Nancy,代码行数:11,代码来源:MakeAppLocalPathFixture.cs

示例2: Should_support_extended_site_root

        public void Should_support_extended_site_root()
        {
            // Given
            var uri = new Uri("http://host/");

            // When
            string result = uri.MakeAppLocalPath(new Uri("http://host/rel/file"));

            // Then
            result.ShouldEqual("/rel/file");
        }
开发者ID:JulianRooze,项目名称:Nancy,代码行数:11,代码来源:MakeAppLocalPathFixture.cs

示例3: Should_return_path_with_same_casing_as_full_uri

        public void Should_return_path_with_same_casing_as_full_uri()
        {
            // Given
            var uri = new Uri("http://host/base/");

            // When
            string result = uri.MakeAppLocalPath(new Uri("http://host/base/ReL"));

            // Then
            result.ShouldEqual("/ReL");
        }
开发者ID:JulianRooze,项目名称:Nancy,代码行数:11,代码来源:MakeAppLocalPathFixture.cs

示例4: Should_return_root_path_without_trailing_slash_as_slash

        public void Should_return_root_path_without_trailing_slash_as_slash()
        {
            // Given
            var uri = new Uri("http://host/base/");

            // When
            string result = uri.MakeAppLocalPath(new Uri("http://host/base"));

            // Then
            result.ShouldEqual("/");
        }
开发者ID:JulianRooze,项目名称:Nancy,代码行数:11,代码来源:MakeAppLocalPathFixture.cs

示例5: Should_return_path_as_local_path

        public void Should_return_path_as_local_path()
        {
            // Given
            var uri = new Uri("http://host/base/");

            // When
            string result = uri.MakeAppLocalPath(new Uri("http://host/base/rel"));

            // Then
            result.ShouldEqual("/rel");
        }
开发者ID:JulianRooze,项目名称:Nancy,代码行数:11,代码来源:MakeAppLocalPathFixture.cs

示例6: ConvertRequest

        private Request ConvertRequest(Uri baseUri, HttpListenerRequest httpRequest)
        {
            var expectedRequestLength = GetExpectedRequestLength(ConvertToDictionary(httpRequest.Headers));

            var url = new Url
            {
                Scheme = httpRequest.Url.Scheme,
                HostName = httpRequest.Url.Host,
                Port = httpRequest.Url.IsDefaultPort ? null : (int?)httpRequest.Url.Port,
                BasePath = baseUri.AbsolutePath.TrimEnd('/'),
                Path = baseUri.MakeAppLocalPath(httpRequest.Url),
                Query = httpRequest.Url.Query,
            };

            var fieldCount = httpRequest.ProtocolVersion.Major == 2 ? 1 : 2;
            var protocolVersion = string.Format("HTTP/{0}", httpRequest.ProtocolVersion.ToString(fieldCount));

            byte[] certificate = null;
            if (httpRequest.IsSecureConnection)
            {
                var x509Certificate = httpRequest.GetClientCertificate();
                if (x509Certificate != null)
                {
                    certificate = x509Certificate.RawData;
                }
            }

            return new Request(
                httpRequest.HttpMethod,
                url,
                RequestStream.FromStream(httpRequest.InputStream, expectedRequestLength, false),
                ConvertToDictionary(httpRequest.Headers),
                (httpRequest.RemoteEndPoint != null) ? httpRequest.RemoteEndPoint.Address.ToString() : null,
                protocolVersion,
                certificate);
        }
开发者ID:gaochundong,项目名称:Happer,代码行数:36,代码来源:Engine.cs

示例7: Should_return_path_with_case_insensitive_base_uri_comparison

        public void Should_return_path_with_case_insensitive_base_uri_comparison()
        {
            // Given
            var uri = new Uri("http://host/base/");

            // When
            string result = uri.MakeAppLocalPath(new Uri("http://host/Base/rel"));

            // Then
            result.ShouldEqual("/rel");
        }
开发者ID:JulianRooze,项目名称:Nancy,代码行数:11,代码来源:MakeAppLocalPathFixture.cs


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