Question

I'm working on an ASP.net MVC 3 application. I have an external classic ASP file that renders a fragment of a page.

I understand that in ASP.net MVC 3, I can define a partial view to contain a fragment of HTML that I want to reuse on multiple pages.

The basic idea that I have is that I would like to use an external classic ASP file to render a fragment of HTML in my ASP.net MVC 3 application.

I would like to use it with something like Html.Partial, but that won't work because a classic ASP file is obviously not an MVC partial view.

Another way of doing this would be to add the content of the file to the page with AJAX, but I don't want to add the overhead of another AJAX call to my page. What might be the solution I'm looking for?

Was it helpful?

Solution

Plain HTML: Just read it from disk and output it with @Html.Raw().

Asp or other dynamically created content: You may use HttpWebRequest to get the html markup, and then insert into you own view. You may want to cache the response.

For convenience, you may create extension methods for both methods.

OTHER TIPS

Create a Controller Action that makes the external call and returns the content:

Html.RenderAction("GetContent","ExternalASP"); //GetContent- Action, ExternalASP- Controller
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top