Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Apr 2010
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,554
    Thanks
    80
    Thanked 4,620 Times in 4,583 Posts
    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.

  • #3
    New Coder
    Join Date
    Apr 2010
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 ??

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,554
    Thanks
    80
    Thanked 4,620 Times in 4,583 Posts
    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.

  • #5
    New Coder
    Join Date
    Apr 2010
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 !!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •