ASP.NET equivalent of JSP include

2019-07-15 13:00发布

In JSP I can share HTML code by using include:

<jsp:include page="subsection.jsp" >

For the life of me, I can't tell how in ASP.NET I should be including shared HTML. I could use a template control, but this really isn't the same thing. I could use a site master page and content placeholders, but this also is not the same and requires a different approach to developing my pages.

Am I out of luck or is there a function in ASP.NET similar to JSP's include?

2条回答
聊天终结者
2楼-- · 2019-07-15 13:45

You will have to enable it from the server then only you can use include html files.

<!-- #include file="Static/Menu.html" -->

Instructions to enable SSI in IIS7 are available at http://tech.mikeal.com/

For dynamic content, there is a built-in method of templating called MasterPages, this should be used instead.

查看更多
何必那么认真
3楼-- · 2019-07-15 13:47

I think what you are wanting can be accomplished in Asp.Net through User Controls. If you were in Asp.Net MVC you would want to use Partial Views.

查看更多
登录 后发表回答