Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Image and Stylesheet References in HTML Email

Reply
Thread Tools

Image and Stylesheet References in HTML Email

 
 
=?Utf-8?B?RGF2aWQ=?=
Guest
Posts: n/a
 
      06-27-2007
Hi all,

I need to generate an HTML email message that is sent to internal customers.
Rather than build the message as a string in my code, I have developed a web
page I want to send as the body of the message. I'm using the httpWebRequest
and httpWebResponse objects retrieve the contents of the page, but the images
and stylesheets both use relative addresses that include the tilde
(~/Images/Image.gif). I would like the tilde to be changed to an absolute
uri like http://Server/Site/Images/Image.gif, but I haven't figured out a way
to do it. I have found code to actually attach the images to the email, but
I'd rather use references like the big boys do, such as Microsoft's
newsletters. Surely there are others who have done something like this.
Does anyone have any suggestions?

Thanks,

David
 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      06-27-2007
On Jun 27, 3:28 pm, David <D...@discussions.microsoft.com> wrote:
> Hi all,
>
> I need to generate an HTML email message that is sent to internal customers.
> Rather than build the message as a string in my code, I have developed a web
> page I want to send as the body of the message. I'm using the httpWebRequest
> and httpWebResponse objects retrieve the contents of the page, but the images
> and stylesheets both use relative addresses that include the tilde
> (~/Images/Image.gif). I would like the tilde to be changed to an absolute
> uri likehttp://Server/Site/Images/Image.gif, but I haven't figured out a way
> to do it. I have found code to actually attach the images to the email, but
> I'd rather use references like the big boys do, such as Microsoft's
> newsletters. Surely there are others who have done something like this.
> Does anyone have any suggestions?
>


Hi David

try this code

Uri u = HttpContext.Current.Request.Url;
string i = "/Images/Image.gif";
Uri a = new Uri(u, i);

CSS also could be included in the HTML code using <style></style>

Hope it helps

 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox and XSLT (local stylesheet works, server-based stylesheet fails) David Blickstein XML 14 10-15-2005 11:27 PM
xml:stylesheet use in document with multiple stylesheet options David Blickstein XML 3 08-02-2005 03:10 PM
Difference between bin and obj directories and difference between project references and dll references jakk ASP .Net 4 03-22-2005 09:23 PM
have a stylesheet generate another stylesheet based on XML? Steven An XML 1 11-23-2004 01:07 PM
Stylesheet referanse i stylesheet =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?= XML 3 07-04-2004 03:16 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57