Click here to Skip to main content
15,887,822 members
Home / Discussions / C#
   

C#

 
GeneralRe: Passing datas from one form to anotther in C#.net Pin
Colin Angus Mackay22-Jan-08 0:29
Colin Angus Mackay22-Jan-08 0:29 
GeneralRe: Passing datas from one form to anotther in C#.net Pin
Pete O'Hanlon22-Jan-08 1:49
mvePete O'Hanlon22-Jan-08 1:49 
GeneralRe: Passing datas from one form to anotther in C#.net Pin
Elayaraja Sambasivam22-Jan-08 4:10
Elayaraja Sambasivam22-Jan-08 4:10 
Generalpoint after rotate Pin
Try21-Jan-08 20:08
Try21-Jan-08 20:08 
GeneralRe: point after rotate Pin
CKnig21-Jan-08 20:24
CKnig21-Jan-08 20:24 
QuestionData transfer problem usinging ip address and port number. Pin
manoj_kumar251121-Jan-08 19:58
manoj_kumar251121-Jan-08 19:58 
GeneralRe: Data transfer problem usinging ip address and port number. Pin
CKnig21-Jan-08 20:28
CKnig21-Jan-08 20:28 
GeneralHttpWebRequest help Pin
Bazalgette21-Jan-08 19:51
Bazalgette21-Jan-08 19:51 
Hi there,

I've been having a problem for days regarding the following bit of code. Basically, I have a web service which looks like this...

<br />
[WebMethod]<br />
        public DataSet TestMethod1(string input)<br />
        {<br />
            DataSet ds;<br />
            ds = new DataSet();<br />
                ds.Tables.Add("HIHI");<br />
                return ds;           <br />
        }<br />


...and some code that calls it which looks like this

<br />
HttpWebRequest httpRequest;<br />
			HttpWebResponse httpResponse;<br />
			byte[] inputs=null;<br />
			UTF8Encoding encoding = new UTF8Encoding();;			<br />
			for(int i=0;i<3;i++)<br />
			{				<br />
				httpRequest = (HttpWebRequest)HttpWebRequest.Create("http://localhost/StaticSer/Service1.asmx/TestMethod1");<br />
				httpRequest.Method = "POST";<br />
				httpRequest.Credentials = new NetworkCredential("", "", "");<br />
				httpRequest.KeepAlive = true;<br />
				httpRequest.AllowWriteStreamBuffering = true;<br />
				httpRequest.AllowAutoRedirect = true;<br />
				httpRequest.ContentType = "application/x-www-form-urlencoded";<br />
<br />
				if(i==0)<br />
					inputs = encoding.GetBytes(@"INPUT=someInput_1");<br />
				<br />
				if(i==1)<br />
					inputs = encoding.GetBytes(@"INPUT=someInput_2");<br />
				<br />
				if(i==2)<br />
					inputs = encoding.GetBytes(@"INPUT=someInput_3");<br />
<br />
				httpRequest.ContentLength = inputs.Length;<br />
				httpRequest.GetRequestStream().Write(inputs, 0, inputs.Length);<br />
				httpResponse = (HttpWebResponse)httpRequest.GetResponse();<br />
<br />
				httpResponse.Close();<br />
				httpRequest=null;<br />
				httpResponse = null;				<br />
			}<br />


The problem is that it runs perfectly fine the first time in the loop, but times out on httpRequest.GetRequestStream().Write(inputs, 0, inputs.Length); thereafter.

I am using vs2003 at the moment, and the strange thing is that the code above seem to work perfectly fine in vs2005.

Another thing I've discovered is that the above code works if the web service takes no inputs, e.g.

public DataSet TestMethod1() and
....<br />
inputs = encoding.GetBytes("");<br />
....


I'm guessing it might have something to do with httpRequest not releasing resources after the first run, but am at a lost to know how to be sure. I'd appreciate it if someone could give me some pointers. Thanks
GeneralRe: HttpWebRequest help Pin
Le centriste22-Jan-08 2:57
Le centriste22-Jan-08 2:57 
QuestionOnly one usage of each socket address (protocol/network address/port) is normally permitted Pin
Smithakrishnan21-Jan-08 19:28
Smithakrishnan21-Jan-08 19:28 
GeneralRe: Only one usage of each socket address (protocol/network address/port) is normally permitted Pin
mav.northwind21-Jan-08 19:34
mav.northwind21-Jan-08 19:34 
GeneralConnecting Strings on C# (using visual studio) - making it general/generic Pin
Desmond Lim21-Jan-08 19:08
Desmond Lim21-Jan-08 19:08 
GeneralRe: Connecting Strings on C# (using visual studio) - making it general/generic Pin
CKnig21-Jan-08 20:30
CKnig21-Jan-08 20:30 
GeneralRe: Connecting Strings on C# (using visual studio) - making it general/generic Pin
Mark Churchill21-Jan-08 21:55
Mark Churchill21-Jan-08 21:55 
GeneralRe: Connecting Strings on C# (using visual studio) - making it general/generic Pin
PIEBALDconsult22-Jan-08 4:22
mvePIEBALDconsult22-Jan-08 4:22 
GeneralProblem realted to Dundas Chart Pin
Aavesh Agarwal21-Jan-08 18:45
Aavesh Agarwal21-Jan-08 18:45 
GeneralRe: Problem realted to Dundas Chart Pin
Pete O'Hanlon21-Jan-08 23:55
mvePete O'Hanlon21-Jan-08 23:55 
Questionsaving data into excel file Pin
sindhutiwari21-Jan-08 18:33
sindhutiwari21-Jan-08 18:33 
GeneralRe: saving data into excel file Pin
Giorgi Dalakishvili21-Jan-08 20:11
mentorGiorgi Dalakishvili21-Jan-08 20:11 
GeneralRe: saving data into excel file Pin
Justin Perez22-Jan-08 4:00
Justin Perez22-Jan-08 4:00 
QuestionChange system date style formate through codding Pin
Naveed72721-Jan-08 18:04
Naveed72721-Jan-08 18:04 
GeneralRe: Change system date style formate through codding Pin
imsathy21-Jan-08 18:30
imsathy21-Jan-08 18:30 
GeneralRe: Change system date style formate through codding Pin
Naveed72721-Jan-08 19:20
Naveed72721-Jan-08 19:20 
GeneralRe: Change system date style formate through codding Pin
DaveyM6921-Jan-08 23:28
professionalDaveyM6921-Jan-08 23:28 
GeneralRe: Change system date style formate through codding Pin
Pete O'Hanlon21-Jan-08 23:54
mvePete O'Hanlon21-Jan-08 23:54 

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.