Recently I needed to post some json data from browser to web server. I used the following codes to read the input stream:
System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
string json = sr.ReadToEnd();
There's one problem with the above codes, that is the json variable will hold empty string even though I am sure that data is posted to the web server. The resolution of the problem is to always set the stream position to 0. The resulting codes looks like this:
Request.InputStream.Position = 0; System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
string json = sr.ReadToEnd();
Now with the first line of the codes, you will be able to get the stream data.
Showing posts with label jQuery. Show all posts
Showing posts with label jQuery. Show all posts
Wednesday, March 2, 2011
Tip: Asp.Net Request.InputStream is empty?
Monday, June 22, 2009
Tip: Solving jQuery Dialog Scrolling Problem.
Scenario:
Add a jQuery accordion widget into the jQuery dialog. The version of the jQuery used was 1.3.2 and the version for the jQuery UI was 1.7.2
Problem Statement:
The dialog vertical scrollbar did not actually scroll when the dialog content length is more than the dialog height.
Resolution:
Add a "position: relative" into the dialog "div", that will solve the scrolling problem. It's tested in IE7 and FF3.0
Example:
<div id="historyDialog" class="demo" title="Last 10 Orders" style="position:relative">
Subscribe to:
Posts (Atom)