문제

I have a site with a layout, and am trying to render a plain Html file (that can change daily) inside of a view.

I have done partial views before and imagine that the solution would be similar, but after some trial and (and seraching) I have not found a way to include html files, just cshtml.

도움이 되었습니까?

해결책

If you are not a owener of the html file, its better to use iframe to load it. So you will not mess up with their javascript and css files as it loads independently.

In your view

@{
var ExternalPageUrl="www.stackoverflow.com";
}

<div>
<iframe src="@ExternalPageUrl" />
</div>

다른 팁

Just put this in a blank cshtml file:

<div id="html">&nbsp;</div>

$("#html").load("PathToFile/dynamicPage.html");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top