Click here to Skip to main content
15,921,454 members
Home / Discussions / C#
   

C#

 
GeneralRe: Garbage collector Pin
SJ_Phoenix26-Apr-04 19:16
SJ_Phoenix26-Apr-04 19:16 
GeneralRe: Garbage collector Pin
Stefan Troschuetz26-Apr-04 20:40
Stefan Troschuetz26-Apr-04 20:40 
GeneralRe: Garbage collector Pin
Mike Dimmick27-Apr-04 0:04
Mike Dimmick27-Apr-04 0:04 
GeneralRe: Garbage collector Pin
Stefan Troschuetz27-Apr-04 0:28
Stefan Troschuetz27-Apr-04 0:28 
GeneralDockable main Program Pin
camasmartin26-Apr-04 10:35
camasmartin26-Apr-04 10:35 
GeneralRe: Dockable main Program Pin
surgeproof26-Apr-04 11:18
surgeproof26-Apr-04 11:18 
GeneralSystem.Web.Services.Protocols.SoapException Pin
Code Toad26-Apr-04 9:46
Code Toad26-Apr-04 9:46 
GeneralRe: System.Web.Services.Protocols.SoapException Pin
Heath Stewart26-Apr-04 10:11
protectorHeath Stewart26-Apr-04 10:11 
GeneralRe: System.Web.Services.Protocols.SoapException Pin
Code Toad27-Apr-04 3:58
Code Toad27-Apr-04 3:58 
GeneralCustomizing Controls in c# - Help Pin
stan2826-Apr-04 9:01
stan2826-Apr-04 9:01 
GeneralRe: Customizing Controls in c# - Help Pin
Heath Stewart26-Apr-04 9:28
protectorHeath Stewart26-Apr-04 9:28 
GeneralRe: Customizing Controls in c# - Help Pin
stan2827-Apr-04 3:26
stan2827-Apr-04 3:26 
GeneralRe: Customizing Controls in c# - Help Pin
Heath Stewart27-Apr-04 3:41
protectorHeath Stewart27-Apr-04 3:41 
GeneralSending POST HTTP request truncates the last character Pin
Le centriste26-Apr-04 8:15
Le centriste26-Apr-04 8:15 
I have a client using HttpWebRequest to send a POST request to a Web service. Using a TCP sniffer, I can see that the last character is truncated, making the web service wait for the missing last character until it times out. Here is the code:

HttpWebResponse authResponse = null;
			StreamReader responseStreamReader = null;

			try
			{
				byte[] requestBytes = Encoding.UTF8.GetBytes(this.txtRequest.Text);

				HttpWebRequest authRequest = (HttpWebRequest)WebRequest.Create(new Uri(this.txtAuthURI.Text));

				authRequest.Method = "POST";
				authRequest.Credentials = CredentialCache.DefaultCredentials;
				authRequest.ContentType = "text/xml";
				authRequest.ContentLength = requestBytes.Length;

				Stream requestStream = authRequest.GetRequestStream();
				requestStream.Write(requestBytes, 0, requestBytes.Length);
				requestStream.Flush();
				requestStream.Close();
				
				authResponse = (HttpWebResponse)authRequest.GetResponse();

				responseStreamReader = new StreamReader(authResponse.GetResponseStream());

				StringBuilder sb = new StringBuilder();

				sb.AppendFormat("HTTP Status: {0}{1}", authResponse.StatusCode, Environment.NewLine);

				this.txtResponse.Text = sb.ToString();
			}
			catch (Exception ex)
			{
				MessageBox.Show(this, "Cannot send Auth Request: " + ex.GetType().ToString() + ": " + ex.Message);
			}
			finally
			{
				if (null != responseStreamReader)
				{
					responseStreamReader.Close();
				}

				if (null != authResponse)
				{
					authResponse.Close();
				}
			}


I have tried using a StreamWriter, to no avail. Does anyone have an idea of what is wrong here?

--------

"I say no to drugs, but they don't listen."
- Marilyn Manson
GeneralRe: Sending POST HTTP request truncates the last character Pin
Heath Stewart26-Apr-04 8:54
protectorHeath Stewart26-Apr-04 8:54 
GeneralGDI+ OnPaint Pin
mookeroo26-Apr-04 5:54
mookeroo26-Apr-04 5:54 
GeneralRe: GDI+ OnPaint Pin
Heath Stewart26-Apr-04 6:10
protectorHeath Stewart26-Apr-04 6:10 
GeneralRe: GDI+ OnPaint Pin
mookeroo27-Apr-04 0:52
mookeroo27-Apr-04 0:52 
AnswerRe: Splitting a string into a substring and into chars? Pin
Jeff Varszegi26-Apr-04 5:15
professionalJeff Varszegi26-Apr-04 5:15 
AnswerRe: Splitting a string into a substring and into chars? Pin
Jon G26-Apr-04 5:30
Jon G26-Apr-04 5:30 
AnswerRe: Splitting a string into a substring and into chars? Pin
Heath Stewart26-Apr-04 5:49
protectorHeath Stewart26-Apr-04 5:49 
GeneralThings are not working as expected Pin
gUrM33T26-Apr-04 5:12
gUrM33T26-Apr-04 5:12 
GeneralRe: Things are not working as expected Pin
Jon G26-Apr-04 5:20
Jon G26-Apr-04 5:20 
GeneralRe: Things are not working as expected Pin
gUrM33T26-Apr-04 5:29
gUrM33T26-Apr-04 5:29 
GeneralRe: Things are not working as expected Pin
gUrM33T26-Apr-04 5:24
gUrM33T26-Apr-04 5:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.