Below is some actual code that I wrote to render html into a string variable.
I use the renderchildren method (this webform has an instance of a user control embedded in it).
I believe you would use the render method instead if your webform does NOT have user controls in it).
I have xxxxxx'd out the mail server variables..
What is cool about this approach is you can have a webform in your asp.net project and render it to a string variable, once it is in a string variable, you could send it as an html email or (as your topic suggests), send it as in a soap response...
Hope this helps.
P.S. Search the web for some articles (I think 4guysfromrolla has a similar topic) that might help you in this area.
Imports System.Web.Mail
Imports System.IO
Imports System.Data
Imports System.Text
Public Class HTMLEMAILFROMTRACKINGSYSTEM
Inherits System.Web.UI.Page
Protected WithEvents Calendar1 As System.Web.UI.WebControls.Calendar
Protected WithEvents TRACKINGITEMEMAILDETAILS1 As TrackingItemEmailDetails
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim SB As New StringBuilder
Dim SW As New StringWriter(SB)
Dim htmlTW As New HtmlTextWriter(SW)
Try
TRACKINGITEMEMAILDETAILS1.TRKNO = Request.QueryString("TRKNUMBER"

If Request.QueryString("MODE"

= "UPDATE" Then
TRACKINGITEMEMAILDETAILS1.STATUSCHG = Request.QueryString("STATUSCHG"

TRACKINGITEMEMAILDETAILS1.TITLE = "A change in status has occurred for tracking number " & Trim$(Request.QueryString("TRKNUMBER"

) & " " & " " & "<BR>" & TRACKINGITEMEMAILDETAILS1.STATUSCHG
TRACKINGITEMEMAILDETAILS1.STATUSCHG = Request.QueryString("STATUSCHG"

End If
Page.DataBind()
TRACKINGITEMEMAILDETAILS1.RenderBind()
Me.RenderChildren(htmlTW)
Dim strHTMLRENDERED As String = SB.ToString()
Dim objMAIL = New MailMessage
objMAIL.to = "xxxxxxxxxx"
objMAIL.FROM = "xxxxxxx"
objMAIL.subject = "TRACKING SYSTEM"
objMAIL.bodyformat = MailFormat.Html
objMAIL.BODY = strHTMLRENDERED
Response.Write(strHTMLRENDERED)
SmtpMail.SmtpServer = "xxxxxx"
SmtpMail.Send(objMAIL)
Catch ex As Exception
Response.Write(ex.ToString)
End Try
End Sub
Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
Try
Me.Render(writer)
Catch
End Try
End Sub
End Class
Gilbert M. Vanegas
Programmer Analyst III
County of San Bernardino - ISD
Email : gvanegas@isd.sbcounty.gov