2

I'n building MVC on top of an existing Webforms site. I want to have all requests going through controllers, but in some cases I'd like the controller to pass duties on to a webform page - if possible, I'd like it to receive the html generated by the webform page, and then return that as its result.

For example, something like this:

public ActionResult Index()
{
    var html = GenerateHtmlFromWebForm("index.aspx",Request);
    return html;
}

I don't want to do a redirect - I specifcally want to get a webform page to generate html, collect that html, and then return that html from my Controller method.

Is this possible?

Oliver
  • 11,297
  • 18
  • 71
  • 121
  • Normally you would return a View, not raw HTML. Even if it were possible to get the HTML to return, ASP.NET doesn't work this way; it depends on all sorts of magic in the ASP.NET lifecycle like ViewState and CodeBehind which you would be denying the engine upon rendering. – Robert Harvey Sep 26 '12 at 16:40
  • Closely related: http://stackoverflow.com/q/4582866 – Robert Harvey Sep 26 '12 at 16:40

0 Answers0