CATEGORIES
Acer
AMD
Apache
Apple
ASP
Business Object
Compaq
Crystal Reports
CSS
Database
Dell
DOT NET
Fujitsu
Gateway
Google
HP
HTML
IBM
IIS
Intel
Java
Mainframe
Microsoft
Networking
Oracle
SAP
SEO
Sony
SQL Server
Testing
Tomcat
Toshiba
Ubuntu
Visual Basic
Web Hosting
Windows
How to Code and Decode an URL
Published by: San (2/5/2008)
I am passing my variable values in URL so I need to encode and decode it properly. I don't want to pass some character where page not found pops up as a 404 error.
Most Popular Articles
- How to Write Select Case in VB
- What is The New Line Characters for ASP and VB
- How to Code and Decode an URL
- VBscript Regex Example to Strip Special Charater in an ASP Page
- How VBScript StrComp Functions Works with ASP Codes
VBscript Regex Example to Strip Special Charater in an ASP Page >>
COMMENT
Name: Nisa
You can use vbscript built-in function for CODE and customize function for DECODE.
ENCODE: Server.URLEncode(display)
DECODE: Function URLDecode(sDecode)
Dim aSplit
Dim oDecode
Dim I
If IsNull(sDecode) Then
URLDecode = ""
Exit Function
End If
' replace all pluses to spaces
oDecode = REPLACE(sDecode, "+", " ")
' convert %hexdigits to character
aSplit = Split(oDecode, "%")
If IsArray(aSplit) Then
oDecode = aSplit(0)
For I = 0 to UBound(aSplit) - 1
oDecode = oDecode & _
Chr("&H" & Left(aSplit(i + 1), 2)) &_
Right(aSplit(i + 1), Len(aSplit(i + 1)) - 2)
Next
End If
URLDecode = oDecode
End Function