Thursday, April 21, 2011

ASP.NET MVC: Redirecting to an Action on a different application.

I have a copule of MVC apps. I'd like to be able to redirect from one to another? Do I just post to the specific app I'm trying to hit? Is there a way to Html.RedirectToAction on a different app?

From stackoverflow
  • you can use RedirectResult:

    public ActionResult SomeAction()
    {
        // do stuff...
        return Redirect("http://myurl.com");
    }
    
  • What's stopping you from doing the following inside your action?

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

    If you don't want to hard code the http://www.otherapp.com then you could put a configuration setting inside your web.config file for it...?

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.