I'm trying to do a simple mailto inside my C# ASP.Net web app.
string url = HttpContext.Current.Request.Url.AbsoluteUri;
System.Diagnostics.Process.Start("mailto:?subject=View Rig Map&body=" + url);
However if the url has a query string with an ampersand (&) separating the name-value pairs like so "http://localhost:51771/MuseumViewer.aspx?MuseumIDs=3301&CountryIDs=1" the link it cut off in the body of the email at "http://localhost:51771/MuseumViewer.aspx?MuseumIDs=3301."
I don't really want to do anything fancy because all I need to do is have the link in the body of the email. Can anyone help me with this? Would it work if I put the mailto on the client side?
UPDATE with SOLUTION I'm having a tough time deciding on who to pick as the answer but here is the solution I used:
string url = HttpContext.Current.Request.Url.AbsoluteUri;
string link = Server.UrlEncode(url);
System.Diagnostics.Process.Start("mailto:?subject=View Rig Map&body=" + link);
%26 is the URL escape code for an ampersand. Try running UrlEncode() on the url.