473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

HTTPS issue in POST c# WinForms

hi i am creating an HTTPS winforms application in C#, it is using POST method to send buff to an HTTPS form. When i try to send data, and check the traffic, it is sending buffer two times as duplicated. I mean, if my send buffer is "Hi" , it sends "HiHi" to the server. But it is workign fine with a normal HTTP connection. Only in secure(HTTPS) this issues comes. I put a break point on the stream-write, but the buffer there (just befoe sending) contains correct data.. Why it sends doublebuff on HTTPS? Can anybody point me in right direction?

--------------
headers:
POST /login/ HTTP/1.0
Content-Type: application/x-www-form-urlencoded
Host: abc.test.com
Content-Length: 12

username=bobusername=bob

-----------------------




This is the code I am currently using
-----------------------


Expand|Select|Wrap|Line Numbers
  1. string post_data = "username=bob";
  2.  
  3. string uri = "https://abc.test.com/login/";
  4.  
  5. HttpWebRequest request = (HttpWebRequest)
  6. WebRequest.Create(uri); 
  7. request.KeepAlive = false;
  8. request.ProtocolVersion = HttpVersion.Version10;
  9. request.Method = "POST";
  10.  
  11. byte[] postBytes = Encoding.ASCII.GetBytes(post_data);
  12.  
  13. request.ContentType = "application/x-www-form-urlencoded";
  14. request.ContentLength = postBytes.Length;
  15.  
  16. Stream requestStream = request.GetRequestStream();
  17.  
  18. requestStream.Write(postBytes, 0, postBytes.Length);
  19.  
  20. MessageBox.Show(postBytes.Length.ToString());
  21. requestStream.Close();
  22.  
  23. HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  24. StreamReader sr = new StreamReader(response.GetResponseStream());
  25. string tmp = sr.ReadToEnd().Trim();
  26. -----------------------
Mar 17 '12 #1
0 1288

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

Similar topics

16
by: Paul Sweeney | last post by:
Does anyone know of a working (python) https proxy which allows viewing of unencrypted data being sent from my browser to an https site? I've worked my way through most on the list at...
10
by: J.Marsch | last post by:
I know that the controls on a Winform are not thread safe, and that you want to do all of your UI updates on a single thread -- generally the main thread. Now, 2 questions: 1. Does the one...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
1
by: Marwan Abi Khalil via DotNetMonster.com | last post by:
hello, i want to send an XML file over https using POST method (httpwebrequest) if anyone can provide me with some code would be gr8 coz i tried so manything and everytime i get the 500 error...
10
by: amirmira | last post by:
I have a Windows Service developed in VB.NET that attempts to connect to a database as soon as the service starts. I have no problem when I start the service manually - but when I restart the...
4
by: Duffman | last post by:
Hello, I am working with dynamically created WSDL's and I need to change the transaction urls from http to https in the WSDL without redirecting customers to a different location. (I'm using vs...
6
by: nganapat | last post by:
I am trying to post form values to a https web page programmatically using Httpwebrequest but no matter what I do the same login page is returned instead of the next page. I would very much...
1
by: brad | last post by:
Has anyone sent an xml payload via post using urllib? I'd like to do something like this: logon_request = """<LoginRequest> <password>"the_password"</password> <user>"the_user"</user>...
0
by: Rob Williscroft | last post by:
Lorenzo Stella wrote in news:7956f925-1037-49ea-a360-b58d627ffb20 @z24g2000prf.googlegroups.com in comp.lang.python: Curl maybe, http://pycurl.sourceforge.net/ Rob. --...
1
johny10151981
by: johny10151981 | last post by:
have enabled SSL for my site successfully. But few thing is not clear for me yet, 1. SSL is enabled for the entire site. But I want it enable for a specific folder. not the entire site. How to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.