知识库

ASP实现隐藏网页代码的另类方法

来源: 本站    类别: 知识库    日期: 2016/4/1

 思路:

  在html.asp中用<script src="js.asp"></script>方式来显示内容,在html.asp代码中,设置一个session,在js.asp进行判断,如果是设置的值就显示正常内容,如果不是,就隐藏或显示其它内容,在js.asp的结尾把session值改变,在html.asp和js.asp中都加一段代码,使得游览器不缓存页面只能做到简单的隐藏,使用工具软件可以看到源文件,示例代码:

  html.asp程序代码:

<%
Response.Expires = 0
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>查看代码 - www.51windows.Net</title>
<style>
<!--
td { font-family: Tahoma; font-size: 8pt; color: #000080; line-height: 150%;
border: 1 solid #666666; padding: 4 }
-->
</style>
</head>
<body>
<%
session("haiwa") = "hw"
%>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="480">
<tr>
<td id="tmp"><SCRIPT LANGUAGE="JavaScript" src="js.asp" id="js"></SCRIPT></td>
</tr>
</table>
</center>
</div>
</body>
</html>

js.asp程序代码:

<%
Response.Expires = 0
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
if session("haiwa") <> "hw" then
response.write "//欢迎查看源文件"
response.end
end if
%>
//高,这你都能看得出来。我没有招了。。哈哈
document.write ("  先做后想,先想后做,边想边做;只想不做,只做不想,不想不做。------世界是几乎都被这六种人涵盖了,如果作为个人能清楚的分析并看出自己属于哪一类人,至少证明你自己是个聪明人。")
<%
session("haiwa") = ""
%>


相关文章


Copyright © 2004 - 2024 CNHWW Inc. All Rights Reserved
石家庄市征红网络科技有限公司版权所有 邮政编码:050051
服务电话:0311-85315152 13931185013 在线客服QQ:81447932 / 81447933 邮箱: cnhww@163.com