Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
余烬+;web api单页重定向_Api_Redirect_Model View Controller_Ember.js_Routes - Fatal编程技术网

余烬+;web api单页重定向

余烬+;web api单页重定向,api,redirect,model-view-controller,ember.js,routes,Api,Redirect,Model View Controller,Ember.js,Routes,我有一个带有ember和simplemembershipprovider的asp.net mvc web api应用程序。我正在使用的余烬模板和它,余烬应用程序是在用户成功登录到主控制器创建 public ActionResult Index(string returnUrl) { if (User.Identity.IsAuthenticated) { return View("App"); }

我有一个带有ember和simplemembershipprovider的asp.net mvc web api应用程序。我正在使用的余烬模板和它,余烬应用程序是在用户成功登录到主控制器创建

    public ActionResult Index(string returnUrl)
    {
        if (User.Identity.IsAuthenticated)
        {
            return View("App");
        }
        ViewBag.ReturnUrl = returnUrl;
        return View();
    }
有时用户在访问站点时会单击带有id的电子邮件中的链接,如果url包含id,在成功登录后,我想根据url中提供的id将用户重定向到详细页面。例如。我很难弄明白怎么做。由于这是一个客户端ember路由,MVC不区分这条路由,因此它只忽略重定向请求。这是我试过的

  • 在登录控制器中分配url-返回json数据后不会发生任何事情,会停留在登录页面中,即使用户未经身份验证,也不会点击HomeController

    FormsAuthentication.SetAuthCookie(model.UserName,model.RememberMe)
    returnUrl=“”
    返回Json(新的{success=true,redirect=returnUrl})

  • 使用响应重定向。同#1
    重定向(returnUrl)

  • 主控制器中分配的url,同上。
    if(User.Identity.IsAuthenticated)
    {
    returnUrl=“”;
    返回视图(“应用”);
    }
    ViewBag.ReturnUrl=返回URL
    返回视图()
    大多数浏览器甚至不将#发送到服务器,因此您不需要重定向它。这里有一些选择

  • 不要使用哈希,不是每个浏览器都支持它

  • 给他们一个可以重定向的假地址

  • 将该url注入页面上的一些js中,以便在加载时重定向