Tutorial :How to send custom HTTP headers with Flex when using Google Chrome


I am using a UrlRequest to send data to a server. I am sending various parameters via custom HTTP headers in the following way:

urlRequest.requestHeaders.push(new URLRequestHeader("someheader", "somevalue"));  

When the request hits my ASP.NET endpoint (a class implementing IHttpHandler), the HttpRequest Headers property doesn't contain any values if the web browser running my Flex App is Google Chrome. This works fine for IE6, IE7, and Firefox. When I look at the traffic with Fiddler, the custom headers are not there if the browser is Chrome. My crossdomain.xml on the server is wide open to allow all headers:

<allow-http-request-headers-from domain="*" headers="*"/>  

I know that typically parameters are sent over by setting the UrlRequest's data property to a UrlVariables dictionary, but I am already using the data field in this case to send an XML stream.


but I am already using the data field in this case to send an XML stream

Define your xml model to contain these headers. From your question it sounds like you feel you are restricted with the data proprty.

<xmlObjects>      <headers>          <header name="header1" value="foo" />          <header name="header1" value="foo" />      </headers>      <data>          <ip></ip>          <name>Andrew Rea</name>      </data>  </xmlObjects>  

So if I need to send any data I rely on the design of the model which will transport the data.



Browsers limit the headers a flash app can send when making an HTTP request. Different browsers have different limits but they all have limits.

I eventually created a proxy on my server so I could send all the headers I needed for communication with various third party servers.



Ways how to send custom http header in flex

http:// yasob.blogspot.com/2009/05/accessing-http-request-parameter-in.html

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »