views:

370

answers:

3

I'm issuing a HttpWebRequest in silverlight and attempting to read (amongst other things) the headers in the response. Unfortunately, while I can get the response object (HttpWebResponse) any attempt to access the Headers collection results in a "not implemented" exception. Any ideas of how to do this? I'm attempting to pull a large recordset from azure (~8k rows) and need to check the response header for the continuation token.

A: 

The HttpWebRequest does not permit access to the response headers collection. Use the WebClient instead, which exposes a WebResponse.Headers property.

Jon Galloway
A: 

Unfortunately, while that property exists, it similarly returns a Not Implemented Exception.

I'm having a hard time believing that this is as difficult as it seems... I would imagine that many have the same requirement.

argodev
+2  A: 

Thanks to @silverfighter, I have the answer. The trick was to tell SilverLight 3 to let the client (.NET) handle the call rather than the browser (the default). Once you do this, you have access to the response headers both via the WebClient and HttWebRequest approaches. More information here:

http://blogs.msdn.com/carlosfigueira/archive/2009/08/15/fault-support-in-silverlight-3.aspx http://msdn.microsoft.com/en-us/library/dd470096%28VS.95%29.aspx http://blogs.msdn.com/silverlight%5Fsdk/archive/2009/08/12/new-networking-stack-in-silverlight-3.aspx

argodev