我有Register操作,返回IHttpActionResult
public async Task<IHttpActionResult> Register()
{
//some code;
//Here I want after a successful registration, to redirect to the action /Token with parameters
//Like this return Redirect("/Token",new {id = id, name = name}");
}
如何重定向到/Token
答案 0 :(得分:0)
您只需使用[(1,09:00,12:00),(2,10:00,12:00)]
属性修饰请求进入的操作(或整个控制器)。
这样,MVC会将请求传递给内置身份验证提供程序以进行身份验证。
我写了一篇关于使用Web API进行身份验证的博客,其中应该有一些很好的示例和背景信息:http://blogs.msdn.com/b/martinkearn/archive/2015/03/25/securing-and-working-securely-with-web-api.aspx