Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 5th, 2009, 02:54 PM
Authorized User
 
Join Date: May 2004
Posts: 73
Thanks: 0
Thanked 1 Time in 1 Post
Default How to do http GET/POST using socket?

Hi guys,

Today came up with a complex, annoying but compelling problem which must be met. Hope you guys will help and let me say thanks as before. My client has asked for accessing a few web sites by using sockets instead of httpwebrequest/response classes. I am able to access them by providing some http headers. But here can't find a way to manage cookies. Because a couple of sites need cookies to get/post as well as form data. Did anybody work before on http post through sockets? I am already way behind the deadline. Quick help will be highly appreciated.
__________________
BaburMan
 
Old March 6th, 2009, 03:40 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

What do you mean by "manage cookies"?

-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
 
Old March 9th, 2009, 06:53 AM
Authorized User
 
Join Date: May 2004
Posts: 73
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by dparsons View Post
What do you mean by "manage cookies"?

-Doug
You see if we directly use HttpWebRequest and HttpWebResponse classes, we case simply use GetCookies method of CookieContainer object to get cookies defined by the site and provide those cookies back to the next request through Add method of CookieContainer. This way we can get and send cookies to the site making it feel like it is communicating with a browser so that it continues its session. Now for the direct communication through sockets we need to do cookies ourself.
__________________
BaburMan
 
Old May 17th, 2009, 02:40 PM
Registered User
 
Join Date: May 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by baburman View Post
You see if we directly use HttpWebRequest and HttpWebResponse classes, we case simply use GetCookies method of CookieContainer object to get cookies defined by the site and provide those cookies back to the next request through Add method of CookieContainer. This way we can get and send cookies to the site making it feel like it is communicating with a browser so that it continues its session. Now for the direct communication through sockets we need to do cookies ourself.

baburman did you find a solution for this yet? I have the same problem and its driving me nuts.
 
Old May 19th, 2009, 10:07 AM
Authorized User
 
Join Date: May 2004
Posts: 73
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by valimar View Post
baburman did you find a solution for this yet? I have the same problem and its driving me nuts.
Well, This is a matter of a couple of months ago. I had to do lots of digging but no luck. So i was left with httpwebrequest/response objects scenario. I do not say for sure that there's no way using sockets. You can explore the http communication through an http port sniffer like Microsoft Fiddler. It monitors the communications under http protocole. Though you will be able to read incomming and outgoing cookies but the point is how they are retrieved and prepared to send by the browser.
__________________
BaburMan





Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on HTTP Post dgrumbli BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 3 December 20th, 2006 02:03 PM
HTTP post silver_scar C# 2005 0 July 31st, 2006 09:52 AM
HTTP POST/GET d_alchemist JSP Basics 1 April 24th, 2006 09:18 AM
HTTP-POST with C# jcascio ASP.NET 1.0 and 1.1 Professional 3 April 12th, 2004 01:15 PM
HTTP Post .Net sjlsysprg1 Pro VB.NET 2002/2003 5 June 26th, 2003 12:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.