Many friends are asking if you can use include dynamically. This is already in the elite area has a lot of space to explain (keyword: include), here I stress,<!--#include file= "<%fileName%>"--> is absolutely unworkable, if the use of
<%if xxx = "yyy" then%>
<!--#include file= "file1.asp"-->
<%else%>
<!--#include file= "file2.asp"-->
<%end if%>
This will virtually download unnecessary files, affecting the speed of loading the Web page. How to solve this problem? In the essence of the region
1) http://www.dev-club.com/club/bbs/showEssence.asp?id=14354
2) http://www.dev-club.com/club/bbs/showEssence.asp?id=5246&page=1
Have done a good job of explaining that here I don't want to repeat. These methods are:
1)
If xxx = "yyy" Then
Server.Execute ("file1.asp")
Else
Server.Execute ("file2.asp")
End If
2)
If xxx = "yyy" Then
Server.Transfer ("file1.asp")
Else
Server.Transfer ("file2.asp")
End If
3)
if xxx = "yyy" Then
filespec = "File2.asp"
Else
filespec = "File2.asp"
End If
filespec = Server.MapPath (filespec)
SCR = "Scripting.FileSystemObject"
Set fs = Server.CreateObject (SCR)
Set F = Fs.opentextfile (filespec)
Content = F.readall
Set F = Nothing
Set fs = Nothing
Response.Write (content)
What I want to explain is that if you use the above methods to implement the include feature, you have to be aware of the place.
We can file= the <!--#include "file.asp"--> Included in the Web page file.asp as an integral part of the Web page that contains the file.asp, only to save what was originally part of the Web page in another file, so that they would have been a Web page, so that the included page file.asp inherits all the parameters of the page containing the file.asp Number set, include session However, other methods are not the case, in the HTML syntax part can be shared with the main Web page, the ASP part is independent, the special session in general can not be passed from the main page to be included in the page file.asp, this is important, use to pay attention to.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service