Search code examples
c#asp.netasp.net-mvcasp.net-mvc-4asp.net-routing

How to connect Multiple MVC.net Application with other MVC.net Applications?


Is it possible to have an ASP.NET MVC Server that communicates with other MVC.net Applications? ( example is shown in image link )

Example enter image description here

A client first communicates with the Main Server. The Main Server redirects his request to one of the other Servers. The client can't communicate directly with the other servers. It should always be via the Main Server.

So when a user requests MainServer.com

MainServer will direct the user to either on of the following:
S1.MainServer.com
S2.MainServer.com
S3.MainServer.com

Note S1, S2 and S3 are physically separated from each other.


Solution

  • Try this:

    public ActionResult Index()
    {
        if (!S1.Server.IsBusy())
        {
            return new RedirectResult("http://S1.MainServer.com");
        }
        else if(!S2.Server.IsBusy())
        {
            return new RedirectResult("http://S2.MainServer.com");
        }
        else if (!S3.Server.IsBusy())
        {
            return new RedirectResult("http://S3.MainServer.com");
        }
        else return View();
    }