Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-25-2012, 08:34 AM   PM User | #1
betto
New Coder

 
Join Date: Apr 2010
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
betto is an unknown quantity at this point
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
betto is offline   Reply With Quote
Old 10-25-2012, 08:03 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,556
Thanks: 62
Thanked 4,056 Times in 4,025 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Server.URLEncode(xxx)

There is also Server.HTMLEncode

Here:
http://msdn.microsoft.com/en-us/libr...(v=vs.90).aspx
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Old 10-26-2012, 09:38 AM   PM User | #3
betto
New Coder

 
Join Date: Apr 2010
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
betto is an unknown quantity at this point
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 ??
betto is offline   Reply With Quote
Old 10-26-2012, 08:20 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,556
Thanks: 62
Thanked 4,056 Times in 4,025 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Old 10-29-2012, 09:30 AM   PM User | #5
betto
New Coder

 
Join Date: Apr 2010
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
betto is an unknown quantity at this point
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 !!!
betto is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


Advertisement
Log in to turn off these ads.