-
Notifications
You must be signed in to change notification settings - Fork 0
/
clearCache.asp
60 lines (58 loc) · 1.82 KB
/
clearCache.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!--#include file="vbscript.asp"-->
<%
Dim RegEx: Set RegEx = New RegExp
With RegEx
.Pattern = "(\[[^\[]*\])+"
.IgnoreCase = True
.Global = True
.MultiLine = True
End With
DIM content_type: content_type=Request.ServerVariables("HTTP_ACCEPT")
Response.CharSet = "ISO-8859-1"
ON ERROR RESUME NEXT
IF content_type<>"" THEN
Response.ContentType = content_type
END IF
'IF INSTR(content_type,"xml") THEN
'Response.ContentType = "text/xml"
DIM xmlDoc
Set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load(Request)
DIM file_location
file_location=server.MapPath(".")&"\..\cache\"&request.querystring("file_name")&".xml"
dim fs
Set fs=Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists(file_location) then
fs.DeleteFile(file_location)
end if
set fs=nothing
IF Err.Number<>0 THEN
Response.Clear()
ErrorDesc=Err.Description
Response.Status = "409 Conflict"
response.write "//"&file_location
DIM message: message=RegEx.Replace(Err.Description, "")
IF INSTR(content_type,"xml")>0 THEN %>
<x:message xmlns:x="http://panax.io/xover" type="exception"><%= message %></x:message>
<% ELSEIF INSTR(content_type,"json")>0 THEN
Response.ContentType = "application/json" %>
{"status":"exception","message":"<%= REPLACE(message, """", "\""") %>"}
<% ELSE
Response.ContentType = "application/javascript" %>
this.status='exception';
this.message="<%= REPLACE(message, """", "\""") %>";
<%
END IF
response.end
ELSE
IF INSTR(content_type,"xml")>0 THEN %>
<x:message xmlns:x="http://panax.io/xover" type="success"><%= message %></x:message>
<% ELSEIF INSTR(content_type,"json")>0 THEN
Response.ContentType = "application/json" %>
{"status":"success"}
<% ELSE
Response.ContentType = "application/javascript" %>
this.status='success'
<% END IF
END IF %>