locked
Handler and content RRS feed

  • Question

  • User1118261303 posted

    Hi,

    I have a strange situation that occurs when processing ASP.NET pages with my HttpHandler. Everything seems to work fine, but the first page show smaller characters and buttons when the page is processed using my HttpHandler. I fixed a problem with French characters (accents), but have no idea why the characters are appears smaller than they should. A part of the code that I am using is below. Any idea what could be wrong? Any suggestion? If you need additional code of the handler, please let me know.

    Many thanks.
    Michael

     
                    Dim response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse)
                    Dim StreamResponse As Stream = response.GetResponseStream
                    Dim ResponseReadBufferSize As Integer = 256
                    Dim ResponseReadBuffer() As Byte = New Byte((ResponseReadBufferSize) - 1) {}
                    Dim MemoryStreamResponse As MemoryStream = New MemoryStream
                    Dim ResponseCount As Integer = StreamResponse.Read(ResponseReadBuffer, 0, ResponseReadBufferSize)

                    While (ResponseCount > 0)
                        MemoryStreamResponse.Write(ResponseReadBuffer, 0, ResponseCount)
                        ResponseCount = StreamResponse.Read(ResponseReadBuffer, 0, ResponseReadBufferSize)
                    End While
                    Dim responseData() As Byte = MemoryStreamResponse.ToArray
                    Dim responseDataString As String = Encoding.UTF8.GetString(responseData)

                    ' Proper formatting.
                    'ParseHtmlResponse(response, context, ResponseData)
                    'context.Response.OutputStream.Write(ResponseData, 0, ResponseData.Length)

                    'context.Response.Write(ResponseDataString)
                    context.Current.Response.Write(responseDataString)
                    MemoryStreamResponse.Close()
                    StreamResponse.Close()
                    response.Close()
                    context.ApplicationInstance.CompleteRequest()
     


    Saturday, September 22, 2007 5:04 PM

All replies

  • User-821857111 posted
    The appearance of items in a web page is governed by how the browser handles the CSS information or inline styling that it has been presented with.  To start to identify the source of the problem, I suggest looking at the rendered html using the browser's View Source option.  If you can't identify it from that, try posting the html source for the rendered page here.
    Monday, September 24, 2007 5:20 AM
  • User1118261303 posted

    I don't think that I will be able to post the HTML source, since it contains some confidential data. Does the proxy need to perform any parsing? I have read some material about html parsing, but was not sure whether the proxy needs to perform any parsing at all and why it would need to do so. You mentioned inline styling and I think I found a few differences between the original html source (the one that does not use the proxy) and the one that my proxy produces.

    Thanks.
    Michael

     

    Monday, September 24, 2007 5:32 AM
  • User-821857111 posted

    Does the proxy need to perform any parsing? I have read some material about html parsing, but was not sure whether the proxy needs to perform any parsing at all and why it would need to do so.

    I wouldn't have thought so, but I don't know for sure.

     


    You mentioned inline styling and I think I found a few differences between the original html source (the one that does not use the proxy) and the one that my proxy produces.
     

    That will probably explain your problem. Although I couldn't begin to guess where the differences come from.

    Monday, September 24, 2007 6:20 AM
  • User1118261303 posted

     Hi,

    I created a small project that uses the Handler I wrote, and am now able to post the HTML source code. As you can see, in the HTML code that my Handler produced, there are some <DIV> missing. Also, I have a "width:175px" attribute that is missing in "my" HTML.

    I also used Fiddler and it actually shows that the content-length of "my" HTML is smaller than the one generated by IE.

    Any help/suggestion would be very appreciated.

    Thanks.
    Mike

     

    *********** IE GENERATED HTML ***********

    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Tue, 25 Sep 2007 03:10:46 GMT
    X-Powered-By: ASP.NET
    X-AspNet-Version: 2.0.50727
    Cache-Control: private
    Content-Type: text/html; charset=utf-8
    Content-Length: 1423



    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head><title>
        Untitled Page
    </title></head>
    <body>
        <form name="form1" method="post" action="Default.aspx?sessionid=0" id="form1">
    <div>
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE0MTQ1NDg1OTIPZBYCAgMPZBYCAgUPDxYCHgRUZXh0BUXDqXbDiW50IMOEw5bDnMOEw5bDiMOAw4nDiMOAIMOgw6jDqcOgIHRyaWdnZXJlZC4uLjI1LjA5LjIwMDcgMDU6MTA6NDZkZGRPyN0bGfIl5oa+6JQEimory6MkSA==" />
    </div>

    <script language='javascript'>window.open('PopupLoader.aspx');</script>
        <div>
            <table ID="Table1" Height="150px" Width="308px">
                <tr>
                    <td><input type="submit" name="Button2" value="Button" id="Button2" /></td>
                </tr>

                <tr>
                    <td><span id="Label1" style="display:inline-block;width:175px;">AsyncProxy from WebSite 2</span></td>
                </tr>

                <tr>
                    <td><span id="Label2" style="display:inline-block;width:175px;">�v�nt ���������� ���� triggered...25.09.2007 05:10:46</span></td>
                </tr>
            </table>
        </div>
       
    <div>

        <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgKMsfrABQK7q7GGCCiwDF+59wQHhXYzuiX7Lp7Rlvhb" />
    </div></form>
    </body>
    </html>
    **************************************

     

    ************* HANDLER GENERATE HTML ********************

    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Tue, 25 Sep 2007 03:07:09 GMT
    X-Powered-By: ASP.NET
    X-AspNet-Version: 2.0.50727
    Cache-Control: private
    Content-Type: text/html; charset=utf-8
    Content-Length: 1366



    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head><title>
        Untitled Page
    </title></head>
    <body>
        <form name="form1" method="post" action="Default.aspx?sessionid=0" id="form1">
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE0MTQ1NDg1OTIPZBYCAgMPZBYCAgUPDxYCHgRUZXh0BUXDqXbDiW50IMOEw5bDnMOEw5bDiMOAw4nDiMOAIMOgw6jDqcOgIHRyaWdnZXJlZC4uLjI1LjA5LjIwMDcgMDU6MDc6MDlkZGQ42JgFY51hjJru7LDIUitj4+vfSw==" />

    <script language='javascript'>window.open('PopupLoader.aspx');</script>
        <div>
            <table ID="Table1" Height="150px" Width="308px">
                <tr>
                    <td><input type="submit" name="Button2" value="Button" id="Button2" /></td>
                </tr>

                <tr>
                    <td><span id="Label1" style="display:inline-block;">AsyncProxy from WebSite 2</span></td>
                </tr>

                <tr>
                    <td><span id="Label2" style="display:inline-block;">�v�nt ���������� ���� triggered...25.09.2007 05:07:09</span></td>
                </tr>
            </table>
        </div>
       
    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgKn2JafAgK7q7GGCP+/HOV4sBI3MKpDPf3lhV9Rin3N" /></form>
    </body>
    </html>
    ****************************

    Monday, September 24, 2007 11:26 PM