ASP inside there is no urldecode function, as if ASPX have it, I am not clear, but the ASP inside or use a lot. I looked up the UrlDecode function written by someone else on the internet, but the function was wrong, and in some ways it was hard to understand. And there are errors, when there are obscure double-byte text will produce errors, such as "乄" after the Urlencoder "%81w", decoding can not be successful.
In fact, two-byte code here as long as the "W" also into 16 into the ASC code can be.
Knowledge Point: The cookie in the computer is also urlencode encoded, so UrlDecode is also useful for cracking cookies.
The following is the source code:
Function UrlDecode (enstr)
Dim destr
Dim c,i,v
Destr= ""
for I=1 to Len (E NSTR)
C=mid (enstr,i,1)
if c= "%" then
v=eval ("&h" +mid (enstr,i+1,2))
If V <128 then
DESTR=DESTR&CHR (v)
i=i+2
Else
if Isvalidhex (Mid (enstr,i,3)) Then
if Isvalidhex (Mid (enstr,i+3,3)) then
V=eval ("&h" +mid (enstr,i+1,2) +mid (enstr,i+4,2))
DESTR=DESTR&CHR (v)
i=i+5
Else
V=eval ("&h" +mid (enstr,i+1,2) +cstr ( Hex (ASC (Mid enstr,i+3,1)))
DESTR=DESTR&CHR (v)
i=i+3
End If
else
& nbsp Destr=destr&c
End If
End If
else
if c= "+" then
destr=destr& ""
Else
DESTR=DESTR&C
End If
End If
next
URLDECODE=DESTR
End Function
function Isvalidhex (str)
Isvalidhex=true
Str=ucase (str)
If Len (str) <>3 then Isvalidhex=false:exit function
If left (str,1) <> "%" then Isvalidhex=false:exit function
C=mid (str,2,1)
If not ((c>= "0") and (c<= "9")) or ((c>= "A") and (c<= "Z")) then Isvalidhex=false:exit function
C=mid (str,3,1)
If not ((c>= "0") and (c<= "9")) or ((c>= "A") and (c<= "Z")) then Isvalidhex=false:exit function
End Function
You use this method to decode "%81w" look, it's OK.
Of course, you can also play a little bit, make it a string encryption of their own way.