web 2.0

ASP Server.URLEncode() - Server Object

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

ASP & Server.URLEncode()

ASP & Server.URLEncode()

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.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.