<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <%response.CODEPAGE=65001 %> <%response.Charset="utf-8"%> <% dim add_no_value '是否添加值为空白的参数作为文件名,默认是false' add_no_value = false dim filepath asp_file_name = Request.ServerVariables("SCRIPT_NAME") asp_file_name = replace(asp_file_name,"/","") filepath = replace(asp_file_name, ".", "_") & "/" query = trim(lcase(request.queryString)) '原始query字符串取小写,去除前后空格' if query = "" Then filepath = filepath & "index.html" else arr = split(query,"&") for i=0 to ubound(arr) arr(i) = split(arr(i), "=")(0) Next arr_sort = SortPara(arr) for i=0 to ubound(arr_sort) value = request.queryString(arr_sort(i)) filepath = filepath & arr_sort(i) & "=" &value if i <> ubound(arr_sort) Then filepath = filepath & "&" else filepath = filepath & ".html" end if next end if dst_file = Server.MapPath(filepath) Set fso=Server.CreateObject("Scripting.FileSystemObject") If fso.FileExists(dst_file) then set fso=nothing ReadTextFile dst_file,"utf-8" else set fso=nothing Response.Status = "404 Not Found" end if '列表排序' Function SortPara(sPara) Dim nCount nCount = ubound(sPara) For i = nCount To 0 Step -1 minmax = sPara( 0 ) minmaxSlot = 0 For j = 1 To i mark = (sPara( j ) > minmax) If mark Then minmax = sPara( j ) minmaxSlot = j End If Next If minmaxSlot <> i Then temp = sPara( minmaxSlot ) sPara( minmaxSlot ) = sPara( i ) sPara( i ) = temp End If Next SortPara = sPara end Function Function ReadTextFile(filePath,CharSet) dim stm set stm=Server.CreateObject("adodb.stream") stm.Mode=3 stm.Open stm.LoadFromFile filePath stm.Position=0 stm.Type=2 stm.Charset=CharSet ReadTextFile = stm.ReadText stm.Close set stm=nothing response.write(ReadTextFile) End Function %>