CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   ASP (http://www.codingforums.com/forumdisplay.php?f=8)
-   -   Equivalent of encodeURIComponent (http://www.codingforums.com/showthread.php?t=279280)

betto 10-25-2012 08:34 AM

Equivalent of encodeURIComponent
 
Hi to All,

I have a page with this code:

<%@ Language=VBScript %>
<%
Option Explicit
Dim a_at, a_pj, a_ri, mail
'
a_at = Request("a_at")
a_pj = Request("a_pj")
a_ri = Request("a_ri")

Set mail=CreateObject("CDO.Message")
mail.To="pluto@libero.it"
mail.From="pippo@libero.it"
mail.Subject="Project Planning approved!"
mail.HTMLBody="Doc. SER-" & a_pj & "-" & a_at & "-P-" & a_ri & " is Approved.<br><br>"
mail.Send
Set mail=nothing

All it' s OK !!

I' d like that in the body of the email,
the Doc. SER-2012-SGEF-P-01
(SER-2012-SGEF-P-01 is an example, i have chosen a generic possible value for the request variables)
has an hyperlink associated

if i work in javascript i can solve the problem in this way:

location.href = "mailto:"+document.getElementById('service_sign_3').value+"?subject=Project Planning Approved!&body= %0ADoc.: "+encodeURIComponent(location.href)+" is Approved."


in ASP there is a special code to obtain a similar thing ??

Thanks a lot in advance !!!!

P.S.

in my specific case i solved the problem in this way: but my doubt remains ?? Is there a code similar to encodeURIComponent(location.href)
<%@ Language=VBScript %>
<%
Option Explicit
Dim a_at, a_ho, a_link, a_pj, a_ri, mail
'
a_at = Request("a_at")
a_ho = Request.ServerVariables("server_name")
a_ri = Request("a_ri")
a_link = "http://" & a_ho & "/quality/planning/4_index.asp?p_proj=" & a_pj & "&p_act=" & a_at & "&p_ri=" & a_ri & ""
Set mail=CreateObject("CDO.Message")
mail.To="pluto@libero.it"
mail.From="pippo@libero.it"
mail.Subject="Project Planning approved!"
mail.HTMLBody="Document: <a href='" & a_link & "'>SER-" & a_pj & "-" & a_at & "-PDS-" & a_ri & "</a> is Approved.<br>"
mail.Send
Set mail=nothing

Old Pedant 10-25-2012 08:03 PM

Server.URLEncode(xxx)

There is also Server.HTMLEncode

Here:
http://msdn.microsoft.com/en-us/libr...(v=vs.90).aspx

betto 10-26-2012 09:38 AM

Thanks Old Pedant for your help ...

in my specific case using Server.HTMLencode or Server.URLencode is possible to better the code inside my asp page ??
Specially in mail.HTMLbody ??

Old Pedant 10-26-2012 08:20 PM

You typically only use HTMLEncode when you want to *SHOW* HTML code (e.g., tags *AS TEXT*) in a page. As when making an example or tutorial. Much less common thant URLEncode.

betto 10-29-2012 09:30 AM

Thanks a lot Old Pedant for your help ...

So I undestand that in my case the solution is only what I wrote in my first message...

Thanks again !!! :D


All times are GMT +1. The time now is 04:16 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.