• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Web.Url类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中N2.Web.Url的典型用法代码示例。如果您正苦于以下问题:C# Url类的具体用法?C# Url怎么用?C# Url使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Url类属于N2.Web命名空间,在下文中一共展示了Url类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CanConstruct_AbsoluteLocalPath_WithFragment

 public void CanConstruct_AbsoluteLocalPath_WithFragment()
 {
     Url u = new Url("/hello.aspx#somebookmark");
     Assert.That(u.Path, Is.EqualTo("/hello.aspx"));
     Assert.That(u.Fragment, Is.EqualTo("somebookmark"));
     Assert.That(u.ToString(), Is.EqualTo("/hello.aspx#somebookmark"));
 }
开发者ID:rohancragg,项目名称:n2cms,代码行数:7,代码来源:UrlTests.cs


示例2: CanConstruct_FromHostName

 public void CanConstruct_FromHostName()
 {
     Url u = new Url("http://somesite/");
     Assert.That(u.Scheme, Is.EqualTo("http"));
     Assert.That(u.Authority, Is.EqualTo("somesite"));
     Assert.That(u.ToString(), Is.EqualTo("http://somesite/"));
 }
开发者ID:rohancragg,项目名称:n2cms,代码行数:7,代码来源:UrlTests.cs


示例3: CanConstruct_AbsoluteLocalPath_WithQuery

 public void CanConstruct_AbsoluteLocalPath_WithQuery()
 {
     Url u = new Url("/hello.aspx?something=someotherthing");
     Assert.That(u.Path, Is.EqualTo("/hello.aspx"));
     Assert.That(u.Query, Is.EqualTo("something=someotherthing"));
     Assert.That(u.ToString(), Is.EqualTo("/hello.aspx?something=someotherthing"));
 }
开发者ID:rohancragg,项目名称:n2cms,代码行数:7,代码来源:UrlTests.cs


示例4: FakeHttpContext

		public FakeHttpContext(Url url)
			: this()
		{
			request.appRelativeCurrentExecutionFilePath = "~" + url.Path;
			foreach (var q in url.GetQueries())
				request.query[q.Key] = q.Value;
			request.rawUrl = url.PathAndQuery;
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:8,代码来源:FakeHttpContext.cs


示例5: FakeHttpContext

        public FakeHttpContext(Url url)
            : this()
        {
            request.appRelativeCurrentExecutionFilePath = "~" + url.Path;
            foreach (var q in url.GetQueries())
                request.query[q.Key] = q.Value;
            request.rawUrl = url.PathAndQuery;
			if (url.Path.IndexOf(".ashx/") > 0)
				request.pathInfo = url.Path.Substring(url.Path.IndexOf(".ashx/") + 5);
        }
开发者ID:rukmareddy,项目名称:n2cms,代码行数:10,代码来源:FakeHttpContext.cs


示例6: CreateSize

        public virtual void CreateSize(Url virtualPath, byte[] image, ImageSizeElement size)
        {
            if (!size.ResizeOnUpload)
                return;

            string resizedPath = ImagesUtility.GetResizedPath(virtualPath, size.Name);

			using (var sourceStream = new MemoryStream(image))
			{
				if (size.Width <= 0 && size.Height <= 0)
				{
					using (var destinationStream = files.OpenFile(resizedPath))
					{
						int b;
						while ((b = sourceStream.ReadByte()) != -1)
						{
							destinationStream.WriteByte((byte)b);
						}
					}
				}
				else
				{
					// Delete the image before writing.
					// Fixes a weird bug where overwriting the original file while it still exists
					//  leaves the resized image the with the exact same file size as the original even 
					//  though it should be smaller.
					if (files.FileExists(resizedPath))
					{
						files.DeleteFile(resizedPath);
					}

					try
					{
						using (var destinationStream = files.OpenFile(resizedPath))
						{
							resizer.Resize(sourceStream, new ImageResizeParameters(size.Width, size.Height, size.Mode) { Quality = size.Quality }, destinationStream);
						}
					}
					catch
					{
					}
				}
			}
		}
开发者ID:EzyWebwerkstaden,项目名称:n2cms,代码行数:44,代码来源:UploadedFilesResizer.cs


示例7: CanGet_EmptyQueryDictionary

 public void CanGet_EmptyQueryDictionary()
 {
     Url u = new Url("/hello.aspx");
     var q = u.GetQueries();
     Assert.That(q.Count, Is.EqualTo(0));
 }
开发者ID:rohancragg,项目名称:n2cms,代码行数:6,代码来源:UrlTests.cs


示例8: CanGet_QueryDictionary

 public void CanGet_QueryDictionary()
 {
     Url u = new Url("/hello.aspx?something=someotherthing");
     var q = u.GetQueries();
     Assert.That(q.Count, Is.EqualTo(1));
     Assert.That(q["something"], Is.EqualTo("someotherthing"));
 }
开发者ID:rohancragg,项目名称:n2cms,代码行数:7,代码来源:UrlTests.cs


示例9: CanSplitPath_IntoPathWithoutExtension

 public void CanSplitPath_IntoPathWithoutExtension()
 {
     Url u = new Url("/hello.aspx?something=someotherthing");
     Assert.That(u.PathWithoutExtension, Is.EqualTo("/hello"));
 }
开发者ID:rohancragg,项目名称:n2cms,代码行数:5,代码来源:UrlTests.cs


示例10: CanConstruct_WithBaseSchemeAndRawUrl

		public void CanConstruct_WithBaseSchemeAndRawUrl()
		{
			Url u = new Url("http", "www.n2cms.com", "/Default.aspx?");
			Assert.That(u.Scheme, Is.EqualTo("http"));
			Assert.That(u.Authority, Is.EqualTo("www.n2cms.com"));
			Assert.That(u.PathAndQuery, Is.EqualTo("/Default.aspx"));
		}
开发者ID:rohancragg,项目名称:n2cms,代码行数:7,代码来源:UrlTests.cs


示例11: UpdatingQueryToNull_ReturnsOtherParameters_WhenUpdatingLast

        public void UpdatingQueryToNull_ReturnsOtherParameters_WhenUpdatingLast()
        {
            Url u = new Url("/hello.aspx?something=someotherthing&query=value&query3=value3");
            u = u.SetQueryParameter("query3", null);
            Assert.That(u.ToString(), Is.EqualTo("/hello.aspx?something=someotherthing&query=value"));
		}
开发者ID:rohancragg,项目名称:n2cms,代码行数:6,代码来源:UrlTests.cs


示例12: 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


示例13: NullUrl

		public void NullUrl()
		{
			Url u = new Url((string)null);
			Assert.That(u.Path, Is.EqualTo(""));
			Assert.That(u.ToString(), Is.EqualTo(""));
		}
开发者ID:rohancragg,项目名称:n2cms,代码行数:6,代码来源:UrlTests.cs


示例14: EmptyUrl

        public void EmptyUrl()
        {
            Url u = new Url("");
            Assert.That(u.Path, Is.EqualTo(""));
            Assert.That(u.ToString(), Is.EqualTo(""));
		}
开发者ID:rohancragg,项目名称:n2cms,代码行数:6,代码来源:UrlTests.cs


示例15: CanConstruct_FromHostName_WithPath_AndQuery_AndFragment

 public void CanConstruct_FromHostName_WithPath_AndQuery_AndFragment()
 {
     Url u = new Url("http://somesite/some/path?key=value#bookmark");
     Assert.That(u.Scheme, Is.EqualTo("http"));
     Assert.That(u.Authority, Is.EqualTo("somesite"));
     Assert.That(u.Path, Is.EqualTo("/some/path"));
     Assert.That(u.Query, Is.EqualTo("key=value"));
     Assert.That(u.Fragment, Is.EqualTo("bookmark"));
     Assert.That(u.ToString(), Is.EqualTo("http://somesite/some/path?key=value#bookmark"));
 }
开发者ID:rohancragg,项目名称:n2cms,代码行数:10,代码来源:UrlTests.cs


示例16: CanConstruct_HomePath

 public void CanConstruct_HomePath()
 {
     Url u = new Url("/");
     Assert.That(u.Path, Is.EqualTo("/"));
     Assert.That(u.ToString(), Is.EqualTo("/"));
 }
开发者ID:rohancragg,项目名称:n2cms,代码行数:6,代码来源:UrlTests.cs


示例17: SelectedUrl

		public string SelectedUrl(Url baseUrl, ContentItem selected = null)
		{
			return baseUrl.AppendQuery(SelectedQueryKey, (selected ?? SelectedItem).Path).ResolveTokens();
		}
开发者ID:alexjamesbrown,项目名称:n2cms,代码行数:4,代码来源:SelectionUtility.cs


示例18: RequestingUrl

        protected RouteData RequestingUrl(Url url)
        {
            httpContext.request.appRelativeCurrentExecutionFilePath = "~" + url.Path;
            httpContext.request.rawUrl = url;

            NameValueCollection nvc = new NameValueCollection();
            foreach (var kvp in url.GetQueries())
                nvc[kvp.Key] = kvp.Value;
            httpContext.request.query = nvc;

            foreach (var kvp in url.GetQueries())
                httpContext.request.query[kvp.Key] = kvp.Value;

            var data = route.GetRouteData(httpContext);
            requestContext = new RequestContext(httpContext, data);
            urlHelper = new UrlHelper(requestContext, routes);
            htmlHelper = new HtmlHelper(new ViewContext { RequestContext = requestContext, HttpContext = httpContext, RouteData = requestContext.RouteData, Writer = httpContext.Response.Output }, new ViewPage(), routes);
            return data;
        }
开发者ID:AnonymousRetard,项目名称:n2cms,代码行数:19,代码来源:ContentRouteTests.cs


示例19: CanGet_NameVAlueCollection

 public void CanGet_NameVAlueCollection()
 {
     Url u = new Url("/hello.aspx?something=someotherthing");
     var q = u.GetQueryNameValues()["something"];
     Assert.That(q, Is.EqualTo("someotherthing"));
 }
开发者ID:EzyWebwerkstaden,项目名称:n2cms,代码行数:6,代码来源:UrlTests.cs


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Client.ConnectionFactory类代码示例发布时间:2022-05-26
下一篇:
C# Web.Site类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap