Santhosh
Santhosh

Reputation: 20406

get responce from another server in mvc

In my mvc application i need to responce or return view value from another server.

Like calling from one MVC application in a server to another mvc application in a server.

Upvotes: 0

Views: 109

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038710

You could get the response from a server using a WebClient and return it as text:

public ActionResult MyAction()
{
    using (var client = new WebClient())
    {
        string response = client.DownloadString("http://otherserver/controller/action");
        return Content(response, "text/html");
    }
}

Upvotes: 1

Related Questions