Getting access to a page's entire html source

  • Thread starter msnews.microsoft.com
  • Start date
M

msnews.microsoft.com

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()



}

}
 
K

Ken Cox [Microsoft MVP]

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>
 
B

Brock Allen

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top