开发者

get responce from another server in mvc

In my mvc applicat开发者_如何转开发ion 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.


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");
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜