1

This is a follow-up to: Getting Started With ASP.NET MVC3 & Google Checkout: Take 2

It seems that the problem why I'm getting a Bad Request (400 error) - refer to the topic above - is because of this error. Checkout the screen shot below:

enter image description here

So as you can see, there's an exception being thrown and that's probably what's causing all the mess. I tried using a MemoryStream but I got an exception telling me that it cannot cast a System.Net.ConnectStream to a MemoryStream. So how can I solve this problem?

Community
  • 1
  • 1
Kassem
  • 8,116
  • 17
  • 75
  • 116

1 Answers1

2

That is a false lead. Ignore that. You are only seeing that because of the debugger / visualiser trying to show you all the properties (some of which don't make sense for a stream of unknown length).

That said, I'm not sure how it makes sense to add that stream to view-data. Streams are pipes, not buckets. With a few exceptions they don't actually hold the data - they are just intermediaries to a data source / sink.

In terms of finding an actual problem, you need to catch the actual exception that is happening in the code. Ignore anything you see in the visualiser; that is not what your code uses.

I suspect this "connect" stream (I'm not familiar) is intended to be used as a sink - meaning: you write to it. However, to serialize (for view-data) it might be trying to read it. This is just supposition, however, unless you indicate the actual exception that your code is raising (ignoring the visualiser).

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • I do not really want to add it to the ViewData, it's just a way I used to inspect the stream. What I want to do eventually is get the damn call to Google Checkout working correctly. The exception I'm getting (the real one) is a 400 error: Bad Request. Since there isn't anything I could think of that might be causing the problem, I thought I'd inspect all the objects in play to see if there's anything fishy about them and I found out about that stream issue. – Kassem Jun 09 '11 at 17:31
  • @Kassem are you getting the 400 from google? Or are your server raising the 400? If it is the first, I suggest your data (request to google) is wrong. – Marc Gravell Jun 09 '11 at 18:27
  • I do not think it's my server raising the 400. It's definitely Google's server. The call is shown here: http://stackoverflow.com/questions/6295359/getting-started-with-asp-net-mvc3-google-checkout-take-2 – Kassem Jun 09 '11 at 18:46
  • @Kassem as noted on the previous question, you are going to have to use a tool like fiddler to see what you are sending. It sounds like you are simply sending the wrong stuff. This visualiser issue is unrelated. – Marc Gravell Jun 09 '11 at 18:50
  • I'm not sure whether the results I got in Fiddler confirm the visual issue or not (I do not think so, because I saw the data being sent). But take a look at it please, maybe you can see something I couldn't see... Thank you :) – Kassem Jun 09 '11 at 19:41