.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

HttpWebResponse.getResponseStream(): Stream sometimes does not deliver received data from HttpRespon

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :WPF


I have a problem with chunked encoding. We want to keep up a http connection between a JBOSS 5.1 server and a .Net Client using chunked encoding by responding periodically with short from the server upon a http client request.


The server delivers a http response with chunked encoding.
The ResponseStream should deliver each received chunk part immediatly, see code below.


With wireshark I can verify the server sends each chunked packet and the .NET client sends an ACK message (on TCP level)


View Complete Post

More Related Resource Links

Closing the download stream (got from HttpWebResponse.GetResponseStream()) takes some time if we clo



I am using HttpWebRequest to download a file from server. When I get the response stream and start reading from it, I need to cancel reading and close this stream in between (this is something like pause download). Please see the code below.



Stream serverStream = resp.GetResponseStream();

Stream localStream = new FileStream(file_path, FileMode.Open, FileAccess.Write);



            HttpWebRequest getrequest;

            getrequest = (HttpWebRequest)HttpWebRequest.Create(download_uri);

            getrequest.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate");

            getrequest.Timeout = System.Threading.Timeout.Infinite;


Incomplete/truncated data Serialized to disk. Error:End of Stream encountered before parsing was com

Greetings!! i have a dataset which is constantly serialized & deserialized by multiple threads (in a thread safe manner using lock statement) using System.Runtime.Serialization.Formatters.Binary.BinaryFormatter (.net 2.0). The Code below works pretty fine but in some rare scenarios it gives the above exception while deserializing. public void SerializeData(string path, DataSet currentData) { dataStream = new FileStream(path , FileMode.Create, FileAccess.ReadWrite); try { biFormatter.Serialize(dataStream, currentData); } finally { dataStream.Flush(); dataStream.Close(); } } DataSet DeserializeData(string path) { dataStream = new FileStream(path , FileMode.Open, FileAccess.ReadWrite); DataSet storedDataSet = new DataSet(); storedDataSet.Locale = CultureInfo.InvariantCulture; try { storedDataSet = (DataSet)biFormatter.Deserialize(dataStream); } finally { dataStream.Close(); } return storedDataSet; } When i observed the serialized file i realized the file had some in incomplete/truncated data. The truncated file loo

Incoming data not received?


Establishing the connection with myself finishes succesfully, but when I try to send myself an actual message, the string that is supposed to be converted from a byte array is just blank, thus no data is received or does it go wrong somewhere else?


public partial class Form1 : Form
    Socket workersocket;
    Socket client;
    byte[] buffer;
    IPAddress ip;
    IPEndPoint ipend;
    Socket connectclient;
    bool check;
    string readtext;
    public Form1()

    private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
      check = true;
      workersocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
      IPEndPoint ipep = new IPEndPoint(IPAddress.Any, 9049);

StreamAccessor and HttpWebResponse stream


Is it possible to return the Stream from HttpWebResponse.GetResponseStream() from a streamaccessor method? I have a streamaccessor that returns blobs stored on an external web server using the following statements.  When I return the stream returned by HttpWebResponse.GetResponseStream(), I get an error stating that it "Failed to retrieve data from the External System: 'Error - No content exists for this field'". 


If I uncomment out the bold portion and return a MemoryStream instead then it works fine.  While returning a MemoryStream is fine for development, it will not work in production.  I would also prefer to not write the file to disk.  I cannot find anything in the logs stating why it thinks there is no content.


public static Stream GetDocument(string DocumentUri, string username, string password)

// code that generates the url removed.

            string url = urls.First().Value;
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

The incoming tabular data stream (TDS) protocol stream is incorrect. The MARS TDS header contained e


Below error occured like 100 times today morning , have no clue where to start looking into.

Any ideas?




Exception of type 'System.Web.HttpUnhandledException' was thrown.


The incoming tabular data stream (TDS) protocol stream is incorrect. The MARS TDS header contained errors.


   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

Duplicated data received thru SerialPort.Read



Can you help me with this strange problem? I'm communicating with RS232 device thru GPRS modem (RS232)

So, I open port, sent AT commands to call modem on other side and then (after establishing communication between modems) i send commands to remote RS232 device.

After sending command i wait collecting device response data in buffer until receive all 19 bytes of device responce. Strange, but if i try to read device responce again - i receive data (that can't be). Response data looks like i've send my request to device second time.

It looks like some strange write buffer caching or something like that. Can you help me to repair this?


        public bool ReadFromPort(out byte[] data, int len)
            if ((port == null) || (!isConnected) || (!port.IsOpen))

Incoming tabular data stream error

<!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; mso-ansi-language:EN-GB;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.Section1 {page:Section1;} -->

Hi I have an access database linked to a SQL 2008 back end, in the last few weeks I have start to get the following error when the users try to update a particular form.
ODBC--Update on Linked Table Bill Phonenum Add Failed.

[Microsoft][SQL Server Native Client 10.0][Sql Serer]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 2 (""):data type 0X00 is unknown. (#8009)

I have searched for a fix for this but I can not find one, the error is inconsistent as it does not happen every time and seems to have moved, when it was first reported it was on a numeric field but it was reported yesterday on a bit field.
even more strange is the fact that if you go to the form change one bit field it does not happen, it

Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.

Surrogate vs Natural Primary Keys - Data Modeling Mistake 2 of 10

In case you're new to the series I've compiled a list of ten data modeling mistakes that I see over and over that I'm tackling one by one. I'll be speaking about these topics at the upcoming IASA conference in October, so I'm hoping to generate some discussion to at least confirm I have well founded arguments.

The last post in this series Referential Integrity was probably less controversial than this one. After all, who can argue against enforcing referential integrity? But as obvious as surrogate keys may be to some, there is a good deal of diversity of opinion as evidenced by the fact that people continue to not use them.

Editing the Data in a GridView

In addition to deleting a GridView's underlying data, another common need is to allow end users to edit the data displayed in a GridView. With ASP.NET 1.x's DataGrid control, editing the data is certainly possible, but requires creating three event handlers and writing a dozen or so lines of code. With the GridView and ASP.NET 2.0, it is possible to create an editable GridView without writing a single line of code! All of the necessary functionality is encapsulated within the GridView.

The GridView allows editing on a row-by-row basis. An editable GridView contains an additional column with an Edit button in each row. When the end user clicks on an Edit button that row becomes editable, causing the Edit button to change to Update and Cancel buttons and the other columns to become TextBoxes. The end user can then update one or more column values and click Update to save their changes.

Using ASP.NET 3.5's ListView and DataPager Controls: Displaying Data with the ListView

Prior to ASP.NET 3.5, developers who needed to display a set of records could choose between the GridView, DataList, and Repeater controls. The GridView provides rich data features, but has a very boxy layout; the DataList and Repeater allow for a more flexible layout, but lack the "point and click" data features found in the GridView, DetailsView, and FormView controls. The ListView bridges the gap between layout flexibility and built-in data features.

This article, the first in a series of articles on the ListView and DataPager controls, looks at the ListView's many available templates and illustrates how to display data. Read on to learn more!

Dynamic Data Templates in GridView ASP.NET 3.5

At a high level, Dynamic Data Templates can be seen as a system to very quickly build up a User Interface linked with the relevant data model, immediately enabling you to perform CRUD operations (Create, Read, Update, Delete) on the database using the specified data source. They provide a powerful method for building up these kinds of applications, and I'm going to focus on an overview of what Dynamic Data Templates actually are, and a few ways of customizing them to suit industry needs.

MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.

Displaying Data using ASP.NET 2.0 Repeater and C#

This tutorial will show you how to display data using the .NET Repeater Control, ASP.NET 2.0 and C#.NET

The Repeater control is a powerful tool and is easy to use.

First, you will need to import the System.Data.SqlClient namespace.

MVC architecture in ASP.Net using C# and Microsoft Data Access Application block

The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes [Burbeck92]:

Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).

View. The view manages the display of information.

Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.

ASP.NET 4.0 Dynamic Data and Many to Many Entity Framework Entities

I did not play much with Dynamic Data controls in VS2008 and just made a cool discovery in VS2010 Beta 2. This may not even be new, but as I'm sitting 30,000+ feet over the Atlantic ocean, I don't have access to VS2008 at the moment to check.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend