Getting access to a page's entire html source

Discussion in 'ASP .Net' started by msnews.microsoft.com, Apr 3, 2005.

  1. Hi,

    Is it possible to gain access to the actual html stream send to the client?
    I am thinking of something like:

    private void Page_Load(object sender, System.EventArgs e)

    {

    if ( !Page.IsPostBack )

    {

    // do stuff

    Bind_Grid()

    Get_Html_Stream()



    }

    }
     
    msnews.microsoft.com, Apr 3, 2005
    #1
    1. Advertising

  2. One was is to use a new instance of the Webclient class. See the VB.NET code
    below.

    Let us know if this helps?

    Ken
    Microsoft MVP [ASP.NET]
    Toronto

    Sub DoPost()
    Dim uriString As String = _
    "http://" & _
    Request.ServerVariables("SERVER_NAME") & _
    Request.ServerVariables("SCRIPT_NAME")
    ' Create a new WebClient instance.
    Dim myWebClient As New System.Net.WebClient
    Dim myNameValueCollection As New _
    System.Collections.Specialized.NameValueCollection
    Dim responseArray As Byte() = myWebClient.UploadValues _
    (uriString, "POST", myNameValueCollection)
    Label1.Text = _
    Server.HtmlEncode _
    (System.Text.Encoding.ASCII.GetString(responseArray))
    End Sub

    Private Sub Button1_Click _
    (ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles Button1.Click
    Call DoPost()
    End Sub

    <form id="Form1" method="post" runat="server">
    <p>
    <asp:label id="Label1" runat="server">Label</asp:label></p>
    <p>
    <asp:button id="Button1" runat="server"
    Text="Button"></asp:button></p>
    </form>

    "msnews.microsoft.com" <> wrote in message
    news:...
    > Hi,
    >
    > Is it possible to gain access to the actual html stream send to the
    > client? I am thinking of something like:
    >
    > private void Page_Load(object sender, System.EventArgs e)
    >
    > {
    >
    > if ( !Page.IsPostBack )
    >
    > {
    >
    > // do stuff
    >
    > Bind_Grid()
    >
    > Get_Html_Stream()
    >
    >
    >
    > }
    >
    > }
    >
    >
     
    Ken Cox [Microsoft MVP], Apr 3, 2005
    #2
    1. Advertising

  3. msnews.microsoft.com

    Brock Allen Guest

    What are you trying to do? You can always access the underlying stream via
    Response.OutputStream.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Hi,
    >
    > Is it possible to gain access to the actual html stream send to the
    > client? I am thinking of something like:
    >
    > private void Page_Load(object sender, System.EventArgs e)
    >
    > {
    >
    > if ( !Page.IsPostBack )
    >
    > {
    >
    > // do stuff
    >
    > Bind_Grid()
    >
    > Get_Html_Stream()
    >
    > }
    >
    > }
    >
     
    Brock Allen, Apr 3, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex
    Replies:
    4
    Views:
    5,179
  2. Shawn Berg

    Accessing entire Web Form HTML Source

    Shawn Berg, Feb 3, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    390
    Shawn Berg
    Feb 3, 2005
  3. Milsnips
    Replies:
    1
    Views:
    572
    =?Utf-8?B?Z3VpbGxhdW1lIFN0RXRpZW5uZSBGUg==?=
    May 16, 2005
  4. Cloud Burst
    Replies:
    11
    Views:
    1,066
  5. Sib

    scanf not getting entire long value

    Sib, May 16, 2005, in forum: C Programming
    Replies:
    6
    Views:
    496
    Kevin D. Quitt
    May 18, 2005
Loading...

Share This Page