Click here to Skip to main content
15,897,519 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionSerialization of colleciton Pin
johnjitu11-Mar-10 0:19
johnjitu11-Mar-10 0:19 
AnswerRe: Serialization of colleciton Pin
SeMartens11-Mar-10 1:30
SeMartens11-Mar-10 1:30 
GeneralRe: Serialization of colleciton Pin
johnjitu11-Mar-10 2:22
johnjitu11-Mar-10 2:22 
AnswerRe: Serialization of colleciton Pin
darkelv11-Mar-10 2:55
darkelv11-Mar-10 2:55 
QuestionVS 2008 and Linux ?? Pin
AmbiguousName10-Mar-10 19:25
AmbiguousName10-Mar-10 19:25 
AnswerRe: VS 2008 and Linux ?? Pin
Rod Kemp10-Mar-10 19:42
Rod Kemp10-Mar-10 19:42 
AnswerRe: VS 2008 and Linux ?? Pin
Eddy Vluggen11-Mar-10 2:18
professionalEddy Vluggen11-Mar-10 2:18 
QuestionKeepAlive implement [modified] Pin
KenKen Wong9-Mar-10 14:13
KenKen Wong9-Mar-10 14:13 
Hi,

I'm trying to implement KeepAlive method in one connection by using the following code.
void SentMsg(String[] msg, int MsgNum )
{
    try
    {
       String reqURI = "www.xxx.com"
       ASCIIEncoding encoding = new ASCIIEncoding();
 
       HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(reqURI);
       myReq.Method = "POST";
       myReq.KeepAlive = true;

       foreach (int index in MsgNum)
       {
          String readContent;
          Byte[] byte = encoding.GetBytes(msg[index]);
          myReq.ContentLength = byte.Length;

          Stream requestStream = myReq.GetRequestStream();
          requestStream.Write(byte, 0, byte.Length);
          requestStream.Close();

          HttpWebResponse response = (HttpWebResponse)myReq.GetResponse();

          Strean receiveStream = response.GetResponseStream();
          StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);

          readContent = readStream.ReadToEnd();
          Console.Write(readContent);
          readStream.Close();
       }
    }
}


There is no problem on the first request send and gotten response.
When sending the second request, the console shows the following message.
"This property cannot be set after writing has started."

Is my concept wrong when implementing KeepAlive method?
modified on Tuesday, March 9, 2010 8:38 PM

AnswerRe: KeepAlive implement Pin
Luc Pattyn9-Mar-10 14:26
sitebuilderLuc Pattyn9-Mar-10 14:26 
QuestionCustom attributes aren't being displayed Pin
jeffb429-Mar-10 9:12
jeffb429-Mar-10 9:12 
AnswerRe: Custom attributes aren't being displayed Pin
Scott Dorman9-Mar-10 17:48
professionalScott Dorman9-Mar-10 17:48 
GeneralRe: Custom attributes aren't being displayed Pin
jeffb4210-Mar-10 7:45
jeffb4210-Mar-10 7:45 
QuestionA new, open source, Outlook panel plugin in C# Pin
François-Denis Gonthier9-Mar-10 7:22
François-Denis Gonthier9-Mar-10 7:22 
QuestionRDLC expression error Pin
Xpnctoc9-Mar-10 5:59
Xpnctoc9-Mar-10 5:59 
QuestionADO .NET Data Services Pin
jonatan_5568-Mar-10 23:18
jonatan_5568-Mar-10 23:18 
AnswerRe: ADO .NET Data Services Pin
Abhinav S9-Mar-10 0:47
Abhinav S9-Mar-10 0:47 
GeneralRe: ADO .NET Data Services Pin
jonatan_55612-Mar-10 5:38
jonatan_55612-Mar-10 5:38 
QuestionIBM, Microsoft, Eclipse and Adobe Vie for IDE Glory at India’s Premier Software Developer Awards Pin
Shaguf Mohtisham8-Mar-10 19:37
Shaguf Mohtisham8-Mar-10 19:37 
QuestionCustomizing Ado .Net Service Operations Pin
jonatan_5568-Mar-10 0:14
jonatan_5568-Mar-10 0:14 
QuestionThe best deployment tools Pin
Nima.naqipoor7-Mar-10 22:19
Nima.naqipoor7-Mar-10 22:19 
AnswerRe: The best deployment tools Pin
The Man from U.N.C.L.E.8-Mar-10 4:02
The Man from U.N.C.L.E.8-Mar-10 4:02 
QuestionError : The "CodeAnalysis" task failed unexpectedly. Pin
deadlyabbas7-Mar-10 19:11
deadlyabbas7-Mar-10 19:11 
AnswerRe: Error : The "CodeAnalysis" task failed unexpectedly. Pin
deadlyabbas7-Mar-10 19:46
deadlyabbas7-Mar-10 19:46 
GeneralRe: Error : The "CodeAnalysis" task failed unexpectedly. Pin
JHizzle8-Mar-10 4:30
JHizzle8-Mar-10 4:30 
Questionhello? Pin
Osairisblue7-Mar-10 17:51
Osairisblue7-Mar-10 17:51 

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.