xoufta
Last Updated: February 25, 2016
·
1.35K
· iondrimba
178548

Render Web Page in C# + ASP.NET MVC

//HTML VIEW

<h2>Web Page</h2>
<div>
    @{
        Html.RenderAction("GetWebPage");
    }
</div>

//MVC CONTROLLER

public ActionResult GetWebPage()
{
    string result = string.Empty;
    try
    {
        using( WebClient client = new WebClient() )
        {
            result = client.DownloadString("http://coderwall.com");
        }
    }
    catch( Exception e)
    {
        result = e.Message;
    }

    return Content(result);
}
Say Thanks
Respond