當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。