教程集 www.jiaochengji.com
教程集 >  脚本编程  >  Asp.net  >  正文 asp.NET中使用include

asp.NET中使用include

发布时间:2016-12-05   编辑:jiaochengji.com
教程集为您提供asp.NET中使用include等资源,欢迎您收藏本站,我们将为您提供最新的asp.NET中使用include资源
A common way to build the navigation and layout for an ASP-driven website is to use include files. Most advanced ASP developers know that when you do this, it is best to encapsulate the functionality of the include file in a Sub or Function, and then to call this routine from the page that is including the file. This avoids problems with variable scope, allows parameters to be passed easily to the include file, and makes the code easier to read.
As these sites are migrated to use ASP.NET, it is likely that classic ASP and ASP.NET pages will exist side-by-side, which is one of the touted advantages of ASP.NET. Unfortunately, there is no built-in way for an ASP.NET page to take advantage of a classic ASP include file, which means that the obvious solution if you want to maintain a consistent look and feel is to duplicate the look of the classic ASP template in an ASP.NET user control. Unfortunately, this means duplicating presentation logic, and inevitably, the classic ASP template and the ASP.NET template will get out of sync.
To overcome this problem, I built a simple user control that uses ASP.NET's built-in page-scraping library, HTTPWebResponse, to grab a template ASP file and render it in my .aspx page. The template ASP file is simply a page that includes my presentation logic include file, and calls the functions to render the HTML, passing through any querystring parameters it has to those functions (such as for page title for a header include file).
For this demonstration, there are six files:
layout_sample.asp - this ASP page uses the include file the standard Classic ASP way.

您可能感兴趣的文章:
asp.NET中使用include
MFC中使用DeviceIoControl
在ASP.NET中使用用户控件
jsp动态include与静态include区别
asp.net中 Table类的使用详解
ASP.NET中使用AJAX中的方式
php中的include()与require()的对比分析
include,require,以及后缀加once的区别
PHP文件包含语句 include、include_once、require、require_onc
php 5.2.x中require、include的区别

[关闭]
~ ~