代码之家  ›  专栏  ›  技术社区  ›  Esteban Araya

ASP.NET MVC:重定向到其他应用程序上的操作

  •  2
  • Esteban Araya  · 技术社区  · 15 年前

    我有一套MVC应用程序。我想能够从一个重定向到另一个?我是否只是发布到我想要点击的特定应用程序?有没有其他应用程序上的html.redirectToAction方法?

    2 回复  |  直到 15 年前
        1
  •  4
  •   Charlino    15 年前

    是什么阻止你在行动中做以下的事情?

    return Redirect("http://www.otherapp.com/product/category");
    

    如果你不想硬编码 http://www.otherapp.com 然后您可以在web.config文件中为它设置一个配置设置…?

        2
  •  1
  •   apiguy    15 年前

    您可以使用RedirectResult:

    public ActionResult SomeAction()
    {
        // do stuff...
        return Redirect("http://myurl.com");
    }