asp.net中包含文件的代碼及使用方法

字號(hào):


    ASP.NET文件包含的方法基本與ASP文件包含差不多!
    在ASP.NET包含文件的方法有:
    1.<% Response.WriteFile("skin/default/footer.txt")%>
    2.<% server.execute("skin/default/footer.txt")%>
    3.StreamReader 對(duì)象將包含文件寫(xiě)到 HTTP 內(nèi)容流中
    //me:網(wǎng)上說(shuō)asp.net中用include也可以的。。
    include和Server.Execute有什么區(qū)別?
    server.execute表示將頁(yè)面運(yùn)行過(guò)后的HTML代碼插入當(dāng)前位置
    include表示將頁(yè)面的源代碼加入當(dāng)前位置再做為一個(gè)整體運(yùn)行
    比方說(shuō)你定義一個(gè)變量dim a
    用server.execute后這個(gè)定義是無(wú)效的
    include的話,這個(gè)定義有效