<%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>
// 下面的不知道什么意思?????????
<%
  Session.CodePage = 936
  Response.ContentType = "application/xml"
  Response.Expires = 0
%>
// 下面的知道是转换字符
<%
function repla(str)
{     
  str = str.replace(/\&/g, "&amp;");
  str = str.replace(/\>/g, "&gt;");
  str = str.replace(/\</g, "&lt;");
  str = str.replace(/\"/g, "&quot;");
  str = str.replace(/\'/g, "&#39;");
  return str;
}//下面这一句是获得IP
var useIp = Request.ServerVariables("REMOTE_ADDR")
//下面开始不明白
if(!Application("counts"))
{
Application("counts") = 0
}
if(Request("cont").Count != 0){
Application.Lock()
if(Application("counts") < 21){
Application("counts") += 1
}else if(Application("counts") >= 21){
Application("counts") = 1
}
var Cnum = Application("counts")
var Msgs = repla(Server.HTMLEncode(Request("cont")))
Application("ips" + Cnum) = useIp +""
Application("msgs" + Cnum) = Msgs +""
if(Request("named").Count != 0){
var names = Request("named")
}else{
var names = ""
}
Application("names" + Cnum) = names +""
Application.UnLock()
}
if(Request("cont") == "cls"){
Application.Contents.RemoveAll()
}
%>
还有可不可以说一下上面这段代码的功能谢谢

解决方案 »

  1.   

    你上面的都是js教本直接放到aspx的html下面就可以运行。
      

  2.   

    你不明白的代码是对一个Application对象进行读取、赋值等操作。Application.Lock()//当修改Application对象前,进行锁定
    Application.UnLock()//解锁
    是为了防止同时修改Application对象。
      

  3.   

    Application.Lock()//当修改Application对象前,进行锁定
    Application.UnLock()//解锁
    这里面做了些什么样的操作这些代码我怎么放在aspx.cs里面可不可以帮我转写过来
      

  4.   

    Application实现的访问计数器功能
    搜索一下,网上现成的ASP.NET的例子很多的!
      

  5.   

    Session.CodePage = 936 是指简体中文的代码页. Response.ContentType = "application/xml" 这种方式很少见,一般应该是text/xml
    expires  = 0表示立即过期,不缓存