Click here to Skip to main content
Licence 
First Posted 6 Nov 2002
Views 56,711
Bookmarked 26 times

URL aliases in emails

By Per S | 6 Nov 2002
How to use URL aliases to fix for the URL wrapping problem in emails

1

2

3
1 vote, 100.0%
4

5
2.39/5 - 8 votes
μ 2.39, σa 5.00 [?]

Introduction

Don't you hate it when you receive emails with links like the one below ? Imagine how your customers feel about it.

Hi,
Look at the new program I just finished: 
http://soderlind.no/this-is-a-very-long-path/with-a-subdirectory/file.as
p?var1=value1&var2=value2&var3=a-verly-long-value


Br,
Per

You can easily fix this by creating an URL alias, and send a mail like this one:

Hi,
Look at the new program I just finished: 
http://soderlind.no/u/?CP001


Br,
Per

To handle URL aliases on your server, do the following:

  • 1st, create a virtual directury on your server: /u
  • 2nd, save the code below as default.asp in the virtual directory, and modify it with your URLs
<%@LANGUAGE="VBSCRIPT"%>
<%
Option Explicit
Const DEFAULTURL = "http://soderlind.no/"
Dim dUrlRedir,strKEY
Set dUrlRedir = CreateObject("Scripting.Dictionary")
'
' Add as many as you wish. If you are going to have a lot of aliases, 
' you should consider storing then in a database
'
dUrlRedir.add "CP001", "http://soderlind.no/this-is-a-very-long-path/with-a-" & _
     "subdirectory/file.asp?var1=value1&var2=value2&var3=a-verly-long-value"
dUrlRedir.add "CP002", _
  "http://www.codeproject.com/aspnet/cassini_apache_101.asp"
dUrlRedir.add "CP003", _
  "http://www.codeproject.com/useritems/xpwebdevfriendly.asp"
'//
If Not IsEmpty(request.ServerVariables("QUERY_STRING")) Then
    strKEY = request.ServerVariables("QUERY_STRING")
    If dUrlRedir.Exists(strKEY) Then
        response.Redirect(dUrlRedir(strKey))    
    Else
        response.Redirect(DEFAULTURL)    
    End If
Else
    response.Redirect(DEFAULTURL)
End If
%>

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Per S

Web Developer

Norway Norway

Member


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Generalwww.tinyurl.com PinsussAnonymous10:30 7 Nov '02  
GeneralRe: www.tinyurl.com PinmemberCypher0:58 8 Nov '02  
GeneralRe: But now you have to... PinmemberPer Soderlind9:27 7 Nov '02  
QuestionVulnerability? PinmemberDerek Lakin3:56 7 Nov '02  
AnswerRe: Vulnerability? PinmemberPer Soderlind4:11 7 Nov '02  
AnswerRe: Vulnerability? PinsitebuilderPaul Watson9:35 7 Nov '02  
GeneralRe: Vulnerability? PinmemberPer Soderlind9:42 7 Nov '02  
AnswerRe: Vulnerability? PinsussAnonymous11:41 8 Jan '03  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120209.1 | Last Updated 7 Nov 2002
Article Copyright 2002 by Per S
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid