Kassem
Kassem

Reputation: 8266

This Stream Does Not Support Seek Operations

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?

Upvotes: 1

Views: 4555

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1062770

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).

Upvotes: 2

Related Questions