1

I have a web app that sends a HTML email in the body of the email are some images the url's of which get pulled from a database table. Unfortunately some of the image files have spaces in the names and when the email is sent the spaces are replaced by + meaning the images don't work in the email can anyone suggest a way to stop the spaces being replaced by + symbols

Thanks

rs82uk
  • 737
  • 2
  • 9
  • 23
  • And you didn't find it necessary to provide some sample code of how you are sending those emails in your question? Just like that: you are sending emails using asp.net. Cool. – Darin Dimitrov Nov 03 '11 at 21:44
  • 2
    URLs can't include spaces. If you want a space in a URL, you encode it as `+`. So the behavior you're seeing is correct, and should work. If it doesn't work, you've got something else wrong. – Joe White Nov 03 '11 at 21:46

1 Answers1

1

Need to URL Encode it.

String MyURL;
MyURL = "http://www.contoso.com/articles.aspx?title=" + Server.UrlEncode("ASP.NET Examples");

Response.Write("<a href=" + MyURL + "> ASP.NET Examples </a>");

From: http://msdn.microsoft.com/en-us/library/zttxte6w.aspx

AaronLS
  • 37,329
  • 20
  • 143
  • 202