Create a page in a class library?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi guys,

I'm working in a C# class library and one of it's functions is to send some
mails.
These mails are meant to contain HTML code and also data obtained
programatically.

No I wonder, insted of having to create all the .html using a StringBuilder
and going back and forth through the data... Is there a way to use an .ASPX
page and render it to obtain the HTML, so I can send it in the
MailMessage.Body?

It would be kinda cool... but I don't know if it's possible. Specially since
I don't have access to a web server to host the page (yes, that way it would
be pretty easy).

Thanks a lot!
 
No, you can't use an ASPX page, but what you CAN use is a template. Create
an HTML template using some form of coding to insert content where you want
to. Then read the template in your code that builds the email, and replace
the coding for content insertion with the content.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
Hi Kevin, thanks for your answer!

Actually, now I'm doing so. But the ASPX solution was way more nice.
May I ask... Is there a way to render a control to HTML, or I still have to
make it all "by hand" (there are some tables involved... so is a long process
and I'm using a StringBuilder).

Cheers.

--
____________________________
Carlos Sosa Albert


Kevin Spencer said:
No, you can't use an ASPX page, but what you CAN use is a template. Create
an HTML template using some form of coding to insert content where you want
to. Then read the template in your code that builds the email, and replace
the coding for content insertion with the content.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
You'll have to do it "by hand." There is no connection between the drawing
of Windows Forms Controls and the rendering of HTML.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

Carlos Sosa Albert said:
Hi Kevin, thanks for your answer!

Actually, now I'm doing so. But the ASPX solution was way more nice.
May I ask... Is there a way to render a control to HTML, or I still have
to
make it all "by hand" (there are some tables involved... so is a long
process
and I'm using a StringBuilder).

Cheers.
 
Back
Top