Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

are there functions like escape/unescape in ASP ?

Posted on 2001-07-13
6
Medium Priority
?
4,112 Views
Last Modified: 2008-03-10
In javascript, there are two function call escape and unescape. Can I use them in ASP ?
0
Comment
Question by:decae2001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 18

Expert Comment

by:mgfranz
ID: 6281494
Yeah, its called Server.URLEncode() and Server.HTMLEncode()
0
 
LVL 11

Expert Comment

by:thunderchicken
ID: 6281495
javascript is client based and ASP is executed on the server..

you might want to make a new function that does that before you want to encode your string.  For example:

<%
mystring = "Jim Bob; Shelia, too"
mystring = replace(replace(replace(mystring," ",""),";",""),",","")
response.write "New string is: " & mystring
%>
0
 

Author Comment

by:decae2001
ID: 6281536
What if I don't want to encode a URL, but to encode a
string, can I still use Server.URLEncode() and Server.HTMLEncode() ?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Expert Comment

by:thunderchicken
ID: 6281552
It does the same thing, it doesn't have to be a specific URL to do.

I would use MGFranz's suggestion over mine because it covers more.
0
 
LVL 18

Accepted Solution

by:
mgfranz earned 60 total points
ID: 6281677
You can do this with any string;

Server.URLEncode(String)

The URLEncode method takes a string and converts it into a URL-encoded format. For example, you can use URLEncode to ensure that hyperlinks in your Active Server Pages are in the correct format.

There is one mandatory argument.

String

The String argument is the string to be encoded.

Code:
<% theStr = Server.URLEncode("This is a test of the URLEcode() Function, % & * # ;")
Response.Write theStr
%>

Output:
This+is+a+test+of+the+URLEcode%28%29+Function%2C+%25+%26+%2A+%23+%3B
0
 
LVL 5

Expert Comment

by:dgorin
ID: 6282657
In addition, you can use escape and unescape on the server if you use JavaScript server-side code.

To use javascript or another scripting language on the server, there are two ways to code it.  If you want the default scripting language (between <% %> tags) to change, use <%@Language="JScript"%> as the first line of your asp page.

If you want to add just some javascript code on the server, use <SCRIPT Language="JScript" RUNAT="server"> </SCRIPT> tags in your code.

You can use PerlScript and other available scripting languages in a similar fashion.

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question