none
WP8 Breaking Change - Automatic Referer's for BitmapImage and WebClient have changed

    Question

  • The referers that BitmapImage and WebClient send have significantly changed making an old WP7 app break when running on WP8 devices.

    Here is what BitmapImage used to send on WP7 :

    And here is what it sends when running inside a WP8 device :

    This can break apps that rely on the correct referer being sent.

     A lot more details and screenshots on the issue here

    Sunday, November 18, 2012 11:27 PM

Answers

  • Hi Anargyros,

    An internal developer (Stefan Wick) proposed possible workarounds:

    To work around this issue, you can use a combination of the following techniques (depending on the actual scenario):

    1. Set the Referer header on the HttpWebRequest (or WebClient) as desired. This is allowed since Mango.
    2. When using Image (or BitmapImage), take ownership of the networking piece and set the Referer there as well, if needed. This can be done with an attached property, so you can still do everything in XAML, using data-binding etc. I had posted this approach (i.e. setting a Referer for an Image element) a some time ago: http://blogs.msdn.com/b/swick/archive/2011/08/04/wp7-mango-image-download-with-custom-referer-header.aspx

    Hope this helps,
    Mark


    Mark Chamberlain Sr. Escalation Engineer | Microsoft Developer Support | Windows Phone 7

    Monday, November 26, 2012 9:21 PM

All replies

  • Thank you very much for your research.  I am forwarding this link to the development and documentation team.

    -Mark


    Mark Chamberlain Sr. Escalation Engineer | Microsoft Developer Support | Windows Phone 7

    Monday, November 19, 2012 10:00 PM
  • Hi Anargyros,

    The development group has logged this into their issues database.

    Can you provide a little more information for our records please?

    1. What is the name of the WP7 app that was broken when upgrading to 8.0?

    2. What kind of service is being consumed by the application?

    Thanks in advance!
    Mark


    Mark Chamberlain Sr. Escalation Engineer | Microsoft Developer Support | Windows Phone 7

    Wednesday, November 21, 2012 3:43 PM
  • Hi Mark,

    1) The application is called "ArcGIS"  http://www.windowsphone.com/en-us/store/app/arcgis/7cb003be-990a-e011-9264-00237de2db9e

    2) It consumes REST services (GIS-Centric) from ESRI's ArcGIS System (ArcGIS Online, Cloud, Server)

    Some links : 

    http://www.arcgis.com/about/ ,
    http://www.arcgis.com/apidocs/rest/ (Portal API) , 
    http://resources.arcgis.com/en/help/rest/apiref/ (Server API)

    P.S We have also released (early on, before Windows 8 launch) a Windows Store app here http://apps.microsoft.com/webpdp/en-us/app/arcgis/db733971-3cc8-4db9-ae5a-865f2853a960

    Please notify me when you have any news about this issue! Meaning when, if and how will it be fixed. I am currently evaluating whether it makes sense to wait for your fix or resolve it with an ugly workaround which i'd much rather avoid.

    Thank you for your help on this!

    Anargyros Tomaras

    Wednesday, November 21, 2012 5:39 PM
  • Thanks, I have forwarded the info.  If I were you I would be inclined to use a workaround because there is no guarantee regarding delivery of the fix, which may be a fix in the SDK or in the phone image itself.

    -Mark


    Mark Chamberlain Sr. Escalation Engineer | Microsoft Developer Support | Windows Phone 7

    Wednesday, November 21, 2012 6:02 PM
  • Hi Anargyros,

    An internal developer (Stefan Wick) proposed possible workarounds:

    To work around this issue, you can use a combination of the following techniques (depending on the actual scenario):

    1. Set the Referer header on the HttpWebRequest (or WebClient) as desired. This is allowed since Mango.
    2. When using Image (or BitmapImage), take ownership of the networking piece and set the Referer there as well, if needed. This can be done with an attached property, so you can still do everything in XAML, using data-binding etc. I had posted this approach (i.e. setting a Referer for an Image element) a some time ago: http://blogs.msdn.com/b/swick/archive/2011/08/04/wp7-mango-image-download-with-custom-referer-header.aspx

    Hope this helps,
    Mark


    Mark Chamberlain Sr. Escalation Engineer | Microsoft Developer Support | Windows Phone 7

    Monday, November 26, 2012 9:21 PM