How to include the contents of simple HTML or classic ASP file in ASP.net MVC 3 view?

I am working on an ASP.net MVC 3 application. I have an external classic ASP file that displays a fragment of a page.

I understand that in ASP.net MVC 3 I can define a partial view to contain an HTML snippet that I want to reuse across multiple pages.

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

I would like to use it with something like Html.Partial, but this will not work, because the classic ASP file is obviously not a partial representation of MVC.

Another way to do this is to add the contents of the file to the page using AJAX, but I don't want to add the overhead of another AJAX call to my page. What could be the solution I'm looking for?

+3
source share
2 answers

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

Asp or other dynamically generated content . You can use HttpWebRequestto get html markup and then paste into your own view. You may want to cache the response.

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

+4
source

Create a controller action that makes an external call and returns the contents:

Html.RenderAction("GetContent","ExternalASP"); //GetContent- Action, ExternalASP- Controller
0
source

All Articles