Page view counter

Reading what went to current page - HTTP Stuff?

Last post 10-06-2008 5:48 AM by NNikola. 5 replies.

Sort Posts:

  • Reading what went to current page - HTTP Stuff?

    09-20-2004, 5:39 PM
    • Loading...
    • mmudassir
    • Joined on 06-18-2002, 6:03 AM
    • San Francisco, CA
    • Posts 83
    • Points 419
    Hi!

    I wanna see what HTML code was rendered and flush to the browser, any possibility of it? and capturing that HTML stuff in the one single variable? If so then what procedure i have to use? what classes I need to know? and any sample artilce related to that topic?

    Take Care,

    Mudassir Azeemi
    San Francisco, CA

    Web: http://www.BonGeek.com
    Blog: http://blog.BonGeek.com
  • Re: Reading what went to current page - HTTP Stuff?

    09-20-2004, 5:49 PM
    • Loading...
    • SomeNewKid
    • Joined on 08-10-2003, 12:16 AM
    • Western Australia
    • Posts 8,027
    • Points 45,844
    > any sample article related to that topic?

    The following all work with the HTML rendered by an ASPX page.

    Capturing Output from ASP.Net Pages

    Modifying Page Output

    Producing XHTML-Compliant Pages With Response Filters

    (Remember, Google knows all.)
    Alister
  • Re: Reading what went to current page - HTTP Stuff?

    09-20-2004, 6:24 PM
    • Loading...
    • mmudassir
    • Joined on 06-18-2002, 6:03 AM
    • San Francisco, CA
    • Posts 83
    • Points 419
    Thansk for quick reply, a query:

    Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
    '' *** Write the HTML into this string builder
    ''StringBuilder sb = new StringBuilder();
    Dim sb As New StringBuilder
    ''StringWriter sw = new StringWriter(sb);
    Dim sw As New StringWriter(sb)
    Dim hW As New HtmlTextWriter(sw)
    Dim pageresult As String
    pageresult = sb.ToString()
    Parent.Render(hW)

    End Sub

    when i wrote this thing it gives an error on Parent.Render(hW) saying :

    'System.Web.UI.Control.Protected Overridable Sub Render(writer As System.Web.UI.HtmlTextWriter)' is not accessible in this context because it is 'Protected'.


    an idea?

    Take Care
    Mudassir Azeemi
    San Francisco, CA

    Web: http://www.BonGeek.com
    Blog: http://blog.BonGeek.com
  • Re: Reading what went to current page - HTTP Stuff?

    09-21-2004, 10:49 AM
    • Loading...
    • MilanNegovan
    • Joined on 01-04-2004, 6:20 PM
    • Long Island, NY
    • Posts 296
    • Points 1,421
    • TrustedFriends-MVPs
    I believe your code should look as follows:

    Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
    Dim sb As New StringBuilder
    Dim sw As New StringWriter(sb)
    Dim hW As New HtmlTextWriter(sw)
    Dim pageresult As String
    MyBase.Render(hW)
    pageresult = sb.ToString()
    writer.Write(pageresult)
    End Sub
    Milan Negovan [ASP.NET MVP]
    http://www.AspNetResources.com
    ASP.NET With Emphasis On Web Standards
  • Re: Reading what went to current page - HTTP Stuff?

    09-24-2004, 5:49 PM
    • Loading...
    • photo_tom
    • Joined on 07-18-2003, 3:52 PM
    • Southern Wisconsin
    • Posts 231
    • Points 1,135
    Question - As I understand it, this has to be added to the page being rendered.

    Is it possible to do this via an Http_Module?
  • Re: Reading what went to current page - HTTP Stuff?

    10-06-2008, 5:48 AM
    • Loading...
    • NNikola
    • Joined on 07-04-2008, 4:37 AM
    • Macedonia
    • Posts 25
    • Points 7

     

    photo_tom:
    Question - As I understand it, this has to be added to the page being rendered.

    Is it possible to do this via an Http_Module?

     

    If you mean with "HttpWebRequest" you can try with:

    HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(Url);
    myRequest.Method = "GET";
    WebResponse myResponse = myRequest.GetResponse();
    StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8);
    string result = sr.ReadToEnd();
    sr.Close();
    myResponse.Close();
    Regards,
    NNikola
Page 1 of 1 (6 items)