不是母板页,包含文件在ASP.NET中是如何使用的?

在网页里包含另一个网页(或文件)方法如下:

一、要包含的文件是css文件的话,用

    <link type=text/css rel=stylesheet href=1.css>

二、要包含的文件是js文件的话,用

    <script language=javascript src=a.js></script>

三、要包含的文件是html文件的话,用

    <!–#include file=”htmlpage.htm”–>

 <iframe src=a.htm width=100 height=100></iframe>
    这种方式可以包含任何一种可以单独运行的文件,比如说htm、asp、jsp、aspx等等

四、要包含的文件是用户控件的话,先新建一个用户控件(.ascx),然后在页面里用
    <%@ Register TagPrefix=”uc” TagName=”top” Src=”top.ascx” %>
    添加引用然后在要包含的位置加上
    <uc:top id=”top” runat=”server”></uc:top>

====================================

另外一种

在ASP.NET包含文件的方法有:

1.<%  Response.WriteFile(“skin/default/footer.txt”)%>

2.<% server.execute (“skin/default/footer.txt”)%>

3.StreamReader 对象将包含文件写到 HTTP 内容流中

//me:网上说asp.net中用include也可以的。。