473,378 Members | 1,360 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Image and Stylesheet References in HTML Email

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
Jun 27 '07 #1
1 1650
On Jun 27, 3:28 pm, David <D...@discussions.microsoft.comwrote:
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

Jun 27 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Terry B. | last post by:
I'm a newbie, so please forgive the naive request here--but I haven't been able to figure this out...Isn't there a way in CSS, to have a plain-old medium-sized (say, 2- or 300-pixels square) image...
10
by: Imran | last post by:
Hi, I am attempting to create a CSS-driven website, in that I want to be able to control the display/content from the CSS file. I do not want to use tables. On a page, I have a background...
3
by: bigoxygen | last post by:
Hi. I have a list that is similar to this: -Evaluation +test +test -Students +test I would like to change the "-" bullet only, but I cannot. My
5
by: Derek Fountain | last post by:
I have a horizontal navigation bar, which is a single row table containing the right images. It "stretches" itself across the screen using a penultimate td like this: <td width="100%"...
1
by: davidfahy | last post by:
Hi all, I have an aspx page and have written a general css stylesheet to brand the page. However I want to make the header image dynamic. Basically a link to the image will be passed to me in the...
6
by: PenguinPig | last post by:
Dear All Experts I would like to know how to convert a HTML into Image using C#. Or allow me contains HTML code (parsed) in Image? I also tried this way but it just display the character "<" &...
6
by: googletired | last post by:
Hello, I haven't made a XSL in quite sometime so i am very rusty. Basicly i want the XSL to display a defined image if one is not present in the XML. here is my current XSL and XML will be...
2
by: studentofknowledge | last post by:
For some unknown reason ie is placing images I have in a div in a weird way. One image is overlapping another but this problem is not occuring in mozilla. I have looked at my code over and over again...
1
by: chennaibala | last post by:
can any one send me mutiple image upload program and save the file name with extension in mysql table.we must cheak uploaded file type like bmp or any image file while uploading. i develop...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.