carviaso / google-checkout-dotnet-sample-code

Automatically exported from code.google.com/p/google-checkout-dotnet-sample-code
0 stars 0 forks source link

GCheckout problem sending URLEncoded Querystrings #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi.

When using the GCheckout API, if you encrypt your querystring data and then
URLEncode it so it can be sent as a fulfilmentUri, the encoding is removed
in the constructor of the DigitalItem object.

This is because DigitalItem using ToString() to make a copy of the URL,
which decodes it. If the original encrypted URL string contains the + sign,
for example (possibly other characters will cause problems), when the
Digital Item is claimed in GoogleCheckout, the Original unEncoded URL is
passed to ASP.NET, including the + sign which is interpreted as a space,
and thus invalidates the encryption leading to Decrypion failing.

The solution is to modify DigitalItem to remove url.ToString(); and replace
it with url.OriginalString; thus retaining any URLEncoding and preserving
the encryption.

    public DigitalItem(Uri url, string description) {
      if (url == null)
        throw new ArgumentNullException(MISSING_KEY_OR_URL);
      _url = url.OriginalString;

      SetDescription(description);
    }

The encrypted Querystring data survives the round trip and is unEncrypted
successfully.

I hope this helps and you agree with the modifications to the Project.
regards
Adrian Gould.

Original issue reported on code.google.com by Adrian.G...@numedia.tv on 14 Feb 2008 at 12:37

GoogleCodeExporter commented 9 years ago
I will look at this tomorrow and attempt to reproduce it.

Joe

Original comment by joseph.f...@gmail.com on 15 Feb 2008 at 2:09

GoogleCodeExporter commented 9 years ago
Sorry I forgot about this issue. Let me look into it and get back to you

Original comment by joseph.f...@gmail.com on 19 Mar 2008 at 5:13

GoogleCodeExporter commented 9 years ago
url.OriginalString;

is only supported in .net 2.0

http://msdn2.microsoft.com/en-us/library/system.uri.originalstring.aspx

I will look into another solution to fix this bug.

Original comment by joseph.f...@gmail.com on 12 Apr 2008 at 7:20

GoogleCodeExporter commented 9 years ago
Fixed as much as I could.

If the original person could verify the fix or provide a more exact url to test.

I now use the AbsoluteUri property.

Original comment by joseph.f...@gmail.com on 12 Apr 2008 at 8:00

GoogleCodeExporter commented 9 years ago
The next release will be .NET 2.0 and this fix will be made.

Original comment by joseph.f...@gmail.com on 25 Jul 2008 at 1:52

GoogleCodeExporter commented 9 years ago

Original comment by mihai.io...@gmail.com on 29 Mar 2011 at 9:39