建站代码网

热门标签

存在的文件

多数的链接都会有针对性的回到数据库,然而从数据库输出可能会被链接到完整独立的输入数据库文件。你可以利用存在的文件来确保你链接到的实际存在的asp文件能被检测到。下面的例子首先会检查我们知道存在的页面(the CodeAve.com 主页 –或者在主目录里名为index,asp的任何页面)和不存在的页面(名为u.文件的变量)。只有能在服务器上找到的页面才能被链接到。

Example of a successful match <br> <% .u文件一定是来自被用来显示信息的asp文件相对地址。 u_file="../index.asp" set fso = createobject("scripting.filesystemobject") 这会被用来检测主目录是否在它的目录里面有index.asp页面 如果有它会超链接它。 if fso.FileExists (server.mappath(u_file)) then Response.Write "Click <a href='"& u_file &"'>here</a>" else Response.Write u_file end if %> <p>&nbsp</p> Example of a unsuccessful match <br> <% .u文件一定是来自被用来显示信息的asp文件相对地址。 u_file="any_file_name_that_may_or_may_not_be_there.asp" set fso = createobject("scripting.filesystemobject") 这会被用来检测主目录是否在它的目录里面有index.asp页面 如果有它会超链接它。 if fso.FileExists (server.mappath(u_file)) then Response.Write "Click <a href='"& u_file &"'>here</a>" else Response.Write u_file end if %>

X