decae2001
asked on
are there functions like escape/unescape in ASP ?
In javascript, there are two function call escape and unescape. Can I use them in ASP ?
Yeah, its called Server.URLEncode() and Server.HTMLEncode()
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(my string," ",""),";",""),",","")
response.write "New string is: " & mystring
%>
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(my
response.write "New string is: " & mystring
%>
ASKER
What if I don't want to encode a URL, but to encode a
string, can I still use Server.URLEncode() and Server.HTMLEncode() ?
string, can I still use Server.URLEncode() and Server.HTMLEncode() ?
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.
I would use MGFranz's suggestion over mine because it covers more.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.