ASP Server.URLEncode() - Application Object URL-encodes a string and returns the encoded string.
ShotDev Focus:
- The URL-encoded text.
Example
asp_server_urlencode1.asp
<% Option Explicit %> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <a href="asp_server_urlencode1.asp?Name1=My Name is Weerachai Nukitram">Link 1</a><br> <a href="asp_server_urlencode2.asp?Name2=<%=Server.URLEncode("My Name is Weerachai Nukitram")%>">Link 2</a><br> </body> </html>
asp_server_urlencode2.asp
<% Option Explicit %> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% Response.write Request.QueryString("Name1") Response.write Request.QueryString("Name2") %> </body> </html>
Create a asp file and save to path root-path/myasp/
Run
http://localhost/myasp/asp_server_urlencode1.asp
Screenshot
Url Default
http://localhost/myasp/asp_server_urlencode1.asp?Name1=My Name is Weerachai Nukitram
Url Using Server.URLEncode
http://localhost/myasp/asp_server_urlencode2.asp?Name2=My+Name+is+Weerachai+Nukitram
.
.
.
Download this script.