Error converting JSON to .Net object in asp.net

前端 未结 4 1659
滥情空心
滥情空心 2020-12-08 18:56

I am unable to convert JSON string to .net object in asp.net. I am sending JSON string from client to server using hidden field (by keeping the JSON object.Tostring() in hid

4条回答
  •  不思量自难忘°
    2020-12-08 19:47

    Unfortunately, none of the proposed solutions solve the real source of the problem. This exception means that your deserializer tries to read from the end of a stream.

    The solution is to rewind the stream to the beginning, ie. set the stream.Position = 0; before deserialization.

    Also, as the comments mention, if you used a StreamWriter you need to flush it before using the stream.

提交回复
热议问题