amazon-web-serviceswindows-8windows-runtimemicrosoft-metro

WinRT and missing Web API models for Amazon API access


I was working with porting the sample from the link below to a Windows 8 Metro styled app

http://aws.amazon.com/code/Product-Advertising-API/2480

Looks like many features from the web model are removed (or moved) in WinRT:

HttpUtility.UrlEncode
HttpUtility.UrlDecode
HMAC / HMACSHA256 

to name a few. Are there alternatives to these on WInRT? I looked online and there's very little insight.


Solution

  • Theres source code for URLDecode here, and looks like Uri.EscapeDataString can be used for Encode.

    http://www.koders.com/csharp/fid1A50096D8FA38302680B0EEDAC5B1CE1AEA855D0.aspx?s=%22Lawrence+Pit%22

    copy the source code over, change the GetChars function to this

        static char [] GetChars (MemoryStream b, Encoding e)
        {
            return e.GetChars (b.ToArray(), 0, (int) b.Length);
        }
    

    I had to use the code snippet from here to properly hash encrypt the string http://channel9.msdn.com/Forums/TechOff/Porting-to-WinRT/4df7586e1ef5400682eda00f0143b610