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


C# UrlHelper.Content方法代码示例

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


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

示例1: Login

        public void Login([FromBody] LoginModel login)
        {         
            var urlHelper = new UrlHelper(Request);
            var url = urlHelper.Content("/oauth/aurelia_token");
            Redirect(url);

            //var user =await AppUserManager.FindByEmailAsync(login.Email);//.FindAsync(login.Email, login.Password);
            //var model = TheModelFactory.Create(user);

            //return Ok(user);
        }
开发者ID:jeremy-holt,项目名称:Cornhouse.Factory-Mutran,代码行数:11,代码来源:AccountsController.cs

示例2: UrlHelper_Content_DefaultsVirtualPathToSlash

        public void UrlHelper_Content_DefaultsVirtualPathToSlash()
        {
            // Arrange
            var request = new HttpRequestMessage();
            request.SetRequestContext(new HttpRequestContext());
            request.RequestUri = new Uri("http://contoso.com/api/Products");
            var urlHelper = new UrlHelper(request);

            // Act
            string link = urlHelper.Content("~/store");

            // Assert
            Assert.Equal("http://contoso.com/store", link);
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:14,代码来源:UrlHelperTest.cs

示例3: UrlHelper_Content_UsesVirtualPathFromConfiguration

        public void UrlHelper_Content_UsesVirtualPathFromConfiguration()
        {
            // Arrange
            var request = new HttpRequestMessage();
            request.SetConfiguration(new HttpConfiguration(new HttpRouteCollection("/AppPath")));
            request.RequestUri = new Uri("http://contoso.com/AppPath/api/Products");
            var urlHelper = new UrlHelper(request);

            // Act
            string link = urlHelper.Content("~/store");

            // Assert
            Assert.Equal("http://contoso.com/AppPath/store", link);
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:14,代码来源:UrlHelperTest.cs

示例4: UrlHelper_Content_CombinesVirtualPath

        public void UrlHelper_Content_CombinesVirtualPath()
        {
            // Arrange
            var request = new HttpRequestMessage();
            request.SetRequestContext(new HttpRequestContext
            {
                VirtualPathRoot = "/AppPath"
            });
            request.RequestUri = new Uri("http://contoso.com/AppPath/api/Products");
            var urlHelper = new UrlHelper(request);

            // Act
            string link = urlHelper.Content("~/store");

            // Assert
            Assert.Equal("http://contoso.com/AppPath/store", link);
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:17,代码来源:UrlHelperTest.cs

示例5: UrlHelper_Content_CombinesAbsolutePath

        public void UrlHelper_Content_CombinesAbsolutePath()
        {
            // Arrange
            var request = new HttpRequestMessage();
            request.RequestUri = new Uri("http://contoso.com/api/Products");
            var urlHelper = new UrlHelper(request);

            // Act
            string link = urlHelper.Content("/store");

            // Assert
            Assert.Equal("http://contoso.com/store", link);
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:13,代码来源:UrlHelperTest.cs

示例6: UrlHelper_Content_NoOpsAbsoluteUrl

        public void UrlHelper_Content_NoOpsAbsoluteUrl()
        {
            // Arrange
            var request = new HttpRequestMessage();
            request.RequestUri = new Uri("http://contoso.com/api/Products");
            var urlHelper = new UrlHelper(request);

            // Act
            string link = urlHelper.Content("http://microsoft.com/webapi");

            // Assert
            Assert.Equal("http://microsoft.com/webapi", link);
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:13,代码来源:UrlHelperTest.cs


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