By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,523 Members | 1,938 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,523 IT Pros & Developers. It's quick & easy.

Internet logging using c# & perl cgi script

P: 84
Hi Guys,
Can someone please help me with this wierd issue?

I have a c# code below
Expand|Select|Wrap|Line Numbers
  1. string lcUrl = "myscript.cgi";
  2.  
  3.  
  4.  
  5.             // *** Establish the request
  6.  
  7.             HttpWebRequest loHttp =
  8.                  (HttpWebRequest)WebRequest.Create(lcUrl);
  9.  
  10.  
  11.  
  12.             // *** Set properties
  13.  
  14.             loHttp.Timeout = 10000;     // 10 secs
  15.  
  16.             loHttp.UserAgent = "Code Sample Web Client";
  17.             //loHttp.
  18.  
  19.             loHttp.Method = "GET";
  20.  
  21.  
  22.  
  23.             // *** Retrieve request info headers
  24.  
  25.             HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse();
  26.  
  27.  
  28.  
  29.             Encoding enc = Encoding.GetEncoding(1252);  // Windows default Code Page
  30.  
  31.  
  32.  
  33.             StreamReader loResponseStream = new StreamReader(loWebResponse.GetResponseStream(), enc);
  34.  
  35.  
  36.  
  37.             string lcHtml = loResponseStream.ReadToEnd();
  38.  
  39.  
  40.  
  41.             loWebResponse.Close();
  42.             loResponseStream.Close();
  43.  
This just goes to a perl cgi script white writes a log on the server. This script has also been attached.

Everything works fine from internet explorer or mozilla, but when i use the above code to fetch the data from the script it writes the same log entry twice which i believe is something to do with above.

Can someone please help???


Thanks in advance
Attached Files
File Type: zip myscript.zip (978 Bytes, 72 views)
Jun 11 '09 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.