|
by Justin posted on 2006/06/23 |
|
How is it possible to view the html source before it is send back to the client (i.e to apply a content filter and deny access to that page).
It seems that the data that is sent (in the private void OnConnected(IAsyncResult ar) method) is only the html header fields or query.. not the actual html source code, or am I looking in the wrong spot?
Any help appreciated, thanks!
Justin
|
by KJ posted on 2006/06/23 |
Reply |
The content/buffer that is forwarded to the client is received from the remote host in OnRemoteReceive. You can view/modify/log the content before forwarding it to the client there. Also note that if using HTTP1.1 the content may be encrypted. The Content-Encoding will tell you what the encryption protocol is if any. Dot net 2.0 framework comes with the necessary classes to decrypt any encoded content. |
by Justin posted on 2006/06/23 |
Reply |
Can you give an example of how to get the buffer into a string in order to view the html? |
by Justin posted on 2006/06/23 |
Reply |
Actually, In the protected void OnRemoteReceive(IAsyncResult ar) method, I converted the RemoteBuffer into a String but it still looks like http headers or something, not actual html source code? |
by SJ posted on 2006/06/30 |
Reply |
Example of getting html in OnRemoteRecieve method.
String html= System.Text.Encoding.UTF8.GetString(m_RemoteBuffer, 0,Ret)
Also try to increase the buffer size. e.g. 2048
|