Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello!
I am c# beginner.
I want to connect http server through user name and password in c#
Posted
Updated 7-Aug-12 6:03am
v2
Comments
Mohibur Rashid 7-Aug-12 10:46am    
search web
Sandeep Mewara 7-Aug-12 10:52am    
What else? Would you like to try anything by yourself?

1 solution

Hi!
This articles shows one way for a MFC/Windows application to talk to a webserver using HTTP protocol:
Making HTTP Communication from MFC/Windows Application[^]

Here an example demonstrates how to connect web service and send a GET request:
http://www.codeforge.com/read/1713/httpresp.c__html[^]

An other example demonstrates how the Chilkat socket object can become a "socket set" that contains other connected socket objects, and this can be used to "select" on multiple sockets for reading. The SelectForReading method waits until one or more sockets in the set have incoming data ready and available to read.
http://www.example-code.com/vcpp/socket_select.asp[^]

The following program example demonstrates how to write a simple client that can connect to the server application:
http://www.installsetupconfig.com/win32programming/windowsocketwinsock214_9.html[^]

The aim of this C++ tutorial is to demonstrate simple client/server socket communication and multi-threading on Windows. This demonstrates basics such as binding, listening and accepting sockets for Servers and connecting sockets for clients. Once the server accepts a socket, a thread is spawned to handle it. This is the simplest Windows C++ socket (blocking) example you can find. Please leave any comments or questions at the end of this tutorial and I will endeavour to answer them.
http://www.tidytutorials.com/2009/12/c-winsock-example-using-client-server.html[^]

Hope this helps you :)
 
Share this answer
 
Comments
Volynsky Alex 7-Aug-12 12:25pm    
Since you changed the subject of your question ,my above answer probably will not help you so much, because my answer considering to work with C++ (how did you like before ,I remember your initial question was so "connect to web server in win32 app")

Nevertheless,the Microsoft .NET framework provides two namespaces, System.Net and System.Net.Sockets for managed implementation of Internet protocols that applications can use to send or receive data over the Internet .

The C# introduces a couple of cover classes to provide event-driven interaction with TCP/IP sockets and simple message protocols, that you can find here:
http://www.codeproject.com/Articles/12286/Simple-Client-server-Interactions-using-C
김포스 7-Aug-12 12:46pm    
Thank you very much!
Volynsky Alex 7-Aug-12 14:57pm    
you are welcome

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900