home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2000 July / macformat-092.iso / Macromedia Flash 4 / Sample Pages / Objects / restore.asp < prev    next >
Encoding:
Text File  |  1999-05-10  |  992 b   |  43 lines

  1. <% 
  2.  
  3. ' Encode a number from 0..15 to a single hex digit
  4. Function HexChar(ByVal i)
  5.     If i < 10 Then
  6.         HexChar = Chr(i+Asc("0"))
  7.     Else
  8.         HexChar = Chr(i-10+Asc("A"))
  9.     End If
  10. End Function
  11.  
  12. ' Encode the control and punctuation characters in a string to %xx hex values
  13. Function URLEncode(ByVal s)
  14.     Dim result, ch
  15.     Do While Len(s) > 0
  16.         ch = Asc(s)
  17.         s = Right(s, Len(s)-1)
  18.         If (ch >= Asc("a") And ch <= Asc("z")) Or (ch >= Asc("A") And ch <= Asc("Z")) Then
  19.             result = result & Chr(ch)
  20.         ElseIf ch = Asc(" ") Then
  21.             result = result & "+"
  22.         Else
  23.             'result = result & "*" & ch
  24.             'result = result & "!" & (ch/16) & (ch mod 16)
  25.             result = result & "%" & HexChar(Int(ch/16)) & HexChar(ch Mod 16)
  26.         End If
  27.     Loop
  28.     URLEncode = result
  29. End Function
  30.  
  31. Response.Expires = 0
  32.  
  33. Application.Lock
  34. id = Application("objectid")
  35. state = Application("objectstate")
  36. Application.Unlock
  37.  
  38. response.write("id=")
  39. response.write(id)
  40. response.write("&state="+URLEncode(state))
  41.  
  42. %>
  43.