locked
Get HTML CODE RRS feed

  • Question

  • User1631009970 posted
    Hi I don't know if this is the correct forum , but... How can I get the HTML code generate from my asp.net page. I need generate the html to user view and send this page by email. How can I made this? tk's
    Wednesday, March 26, 2003 12:52 PM

All replies

  • User1356982465 posted
    protected override void Render (HtmlTextWriter writer) { StringBuilder stringBuilder = new StringBuilder(); StringWriter stringWriter = new StringWriter(stringBuilder); HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter); base.Render(htmlWriter); // ***** Save/Modify/Email yourHtml ***** string yourHtml = stringBuilder.ToString(); writer.Write(yourHtml); }
    Wednesday, March 26, 2003 1:40 PM
  • User1070929020 posted
    this code is crashing the application in vb.net. any ideas? Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter) Dim sb As New StringBuilder() Dim sw As New StringWriter(sb) Dim htmlW As New HtmlTextWriter(sw) Me.Render(htmlW) CacheMsg.Text = sb.ToString End Sub
    Thursday, November 6, 2003 10:15 AM
  • User-731623299 posted
    The following article should help as well: http://aspnet.4guysfromrolla.com/articles/091102-1.aspx
    Thursday, November 6, 2003 12:00 PM
  • User1356982465 posted
    You need to use MyBase.Render instead of Me.Render Also, just a note that you're missing the writer.Write
    Thursday, November 6, 2003 1:26 PM
  • User1881167342 posted

    Thank you so much Paul - ive had a token replacement system in place for a while now but it was not very efficient as I had to call the replace function in like every file at least once.. Now I just need to call it once unless it has to do with loading controls (there is a variable for the location of the controls folder which will be different in live, test and dev environments, so I just use [ControlFolder] and replace this with the correct location, so if it changes then I just need to change it in the replacement module to take effect site wide - for everything else I am able to use the method you suggested here).

    I have just spent about 5 hours trying out different methods and failing to convert them into vb but this one was really easy to do.. thank you SO much again!!


    Clarkey

    Friday, December 4, 2009 8:36 PM