本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}