Link to home
Start Free TrialLog in
Avatar of farooqazam
farooqazam

asked on

Malformed Header from IIS6/ASP.NET

A page hosted on IIS 6 sends a "plain text" response, to be read by a Mobile device, using J2ME. It works fine with some devices, but failes in most of them (for example Symbian UIQ and Symbian S40), giving Malformed header exception.

Following code shows the VB code hosted in IIS:
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Response.ClearHeaders()
        Response.Clear()
        Response.ContentType = "text/plain"
        Response.Write("Some Text")
        Response.Flush()
        Response.End()
    End Sub
Avatar of Dave_Dietz
Dave_Dietz
Flag of United States of America image

Have you taken a network trace of the actual output to see what headers are really being sent?

Dave Dietz
Avatar of farooqazam
farooqazam

ASKER

Thanks Dave

Not really, i thought of it initially but think it may not be of much use, because even if i happen to find some thing odd in the headers, am not sure how will i be able to fix it. I am already doing response.clear() , and whatever is IIS (or ASP.NET) is appending seems cannot be handeled from code. There is definitly some thing wrong with the headers, may be an extra space or something, that most J2ME platforms do not like. Is there any way to tweak IIS or something that can give me more control over how headers are being formed?
You can do just about anything you want to the headers if you're willing to write your own ISAPI filter.

IIS will generate some headers on its own - some of this can be configured, some can't.

Depending on what exactly is being sent that is causing the problem there may be some simple configuration that can change it.

First step is seeing what's being sent.....  :-)

Dave Dietz
Ok, i've got the network trace. This is what it says:

HTTP/1.1 200 OK
Via: 1.1 SERVER-1
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Transfer-Encoding: chunked
Date: Fri, 07 Sep 2007 05:57:21 GMT
Content-Type: text/plain; charset=utf-8
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private

Some Text

How to find out which item is causing problem?
To cross-check, i've also caught the headers returned be "google.com". I also checked with j2ME devices do not have any proble with google page. Following is the header info:

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
Server: GWS/2.1
Content-Length: 2287
Date: Fri, 07 Sep 2007 06:35:06 GMT

I did not see any major differences the way header is formated and also there are no extra spaces. Except there are some xtra header info returned by IIS
ASKER CERTIFIED SOLUTION
Avatar of Dave_Dietz
Dave_Dietz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial