473,800 Members | 2,689 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how can i implement proxyservers in c#.net

hi all,
i have one requirement in my project.The requirement is i want to fix some
domain sites in TcpIp like proxy servers behaviour.When ever end user
passing the inforamtion of that domain sites,at that time i want to get
the inforamtion and i ahve do some operations.How can i implement this
requirement? or What classes are supported in C#.Net? .Please give your
suggestion.This requirement is very urgent.

thanks in advance,
TulsaiKumar

Jan 17 '06 #1
6 2139

"TulasiKuma r" <tu*********@na nnacomputers.co m> wrote in message
news:e$******** ******@tk2msftn gp13.phx.gbl...
hi all,
i have one requirement in my project.The requirement is i want to fix some
domain sites in TcpIp like proxy servers behaviour.When ever end user
passing the inforamtion of that domain sites,at that time i want to get
the inforamtion and i ahve do some operations.How can i implement this
requirement? or What classes are supported in C#.Net? .Please give your
suggestion.This requirement is very urgent.


I'm not sure I understand what you mean. Do you want to be able to connect
to sites through proxy servers or do you need to implement a proxy server
itself?

If you need to connect to HTTP(and FTP in 2.0) through proxy servers,
WebRequest and its ilk supports proxies via the IWebProxy interface and the
Proxy property. I havn't used them personally but hte functionality is
there.

If you need to connect using tcp through a proxy or need to write a proxy
server you will have to look up the specification for the type of proxy you
want and implement it using sockets.

There very well may be third party libraries that can handle proxies as
well.

Jan 17 '06 #2
Me
It would help to know what protocol you are wanting to create a proxy for.

HTTP? Some raw socket protocol? A very abstract database (SQL Server, MySQL,
etc) type of protocol?

The reason for this is that there may already be a standard way of creating
a proxy for some of them (HTTP).

Also if this is HTTP is SSL being used? If so then you are not looking at an
easy solution at all since you will need to also code in the HTTPS stuff for
your proxy and the client would get a message stating that the secure
connection has been breached (well.. at least a message stating that the
server is not who they say they are.)

More information on this would be helpfull to us all though so if you could
give us some details that would be great. Maybe even a simple walkthrough of
what is happening?

"TulasiKuma r" <tu*********@na nnacomputers.co m> wrote in message
news:e$******** ******@tk2msftn gp13.phx.gbl...
hi all,
i have one requirement in my project.The requirement is i want to fix some
domain sites in TcpIp like proxy servers behaviour.When ever end user
passing the inforamtion of that domain sites,at that time i want to get
the inforamtion and i ahve do some operations.How can i implement this
requirement? or What classes are supported in C#.Net? .Please give your
suggestion.This requirement is very urgent.

thanks in advance,
TulsaiKumar


Jan 17 '06 #3
thank for giving reply,
we want to implement proxyserver itself.can u know what type assembles are
supported in c#.Net?Please suggest me or any reference sites.

thanks in advance,
TulasiKumar
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..

"TulasiKuma r" <tu*********@na nnacomputers.co m> wrote in message
news:e$******** ******@tk2msftn gp13.phx.gbl...
hi all,
i have one requirement in my project.The requirement is i want to fix some domain sites in TcpIp like proxy servers behaviour.When ever end user
passing the inforamtion of that domain sites,at that time i want to get the inforamtion and i ahve do some operations.How can i implement this
requirement? or What classes are supported in C#.Net? .Please give your suggestion.This requirement is very urgent.

I'm not sure I understand what you mean. Do you want to be able to

connect to sites through proxy servers or do you need to implement a proxy server itself?

If you need to connect to HTTP(and FTP in 2.0) through proxy servers,
WebRequest and its ilk supports proxies via the IWebProxy interface and the Proxy property. I havn't used them personally but hte functionality is
there.

If you need to connect using tcp through a proxy or need to write a proxy server you will have to look up the specification for the type of proxy you want and implement it using sockets.

There very well may be third party libraries that can handle proxies as
well.



Jan 18 '06 #4
Thank u for giving reply to me.
Hi Me
My requirement is in browser i want to type www.amazon.com so,some data is
passing through the server.In the mean time i want to check this data the
passing data is valid data or not i want check it.
This is my requirement.
So,i have decided to create one proxyserver,Thi s behaves like hook between
target server and client machine.
your question is which protocol is used in this server?HTTP
Please help me the structure of the proxyserver for HTTP protocol?
How can i implement this task in c#.net?
What assemblies are supported in c#.net?
Kindly suggest me.

Thanks in advance
TulasiKumar

"Me" <me@home.com> wrote in message
news:BP******** *************** *******@comcast .com...
It would help to know what protocol you are wanting to create a proxy for.
HTTP? Some raw socket protocol? A very abstract database (SQL Server, MySQL, etc) type of protocol?

The reason for this is that there may already be a standard way of creating a proxy for some of them (HTTP).

Also if this is HTTP is SSL being used? If so then you are not looking at an easy solution at all since you will need to also code in the HTTPS stuff for your proxy and the client would get a message stating that the secure
connection has been breached (well.. at least a message stating that the
server is not who they say they are.)

More information on this would be helpfull to us all though so if you could give us some details that would be great. Maybe even a simple walkthrough of what is happening?

"TulasiKuma r" <tu*********@na nnacomputers.co m> wrote in message
news:e$******** ******@tk2msftn gp13.phx.gbl...
hi all,
i have one requirement in my project.The requirement is i want to fix some domain sites in TcpIp like proxy servers behaviour.When ever end user
passing the inforamtion of that domain sites,at that time i want to get the inforamtion and i ahve do some operations.How can i implement this
requirement? or What classes are supported in C#.Net? .Please give your suggestion.This requirement is very urgent.

thanks in advance,
TulsaiKumar





Jan 18 '06 #5
Dear TulasiKumar,

if you tried this site: http://www.google.com and typed in these words:
proxy server c#, it would have given you these results:
http://www.google.com/search?hl=en&q...ver+c%23&meta= and by clicking
on the second one, you'd get to a complete sample in C# (this one:
http://www.c-sharpcorner.com/internet/web_proxy.asp)

"TulasiKuma r" <tu*********@na nnacomputers.co m> wrote in message
news:eV******** *******@TK2MSFT NGP14.phx.gbl.. .
Thank u for giving reply to me.
Hi Me
My requirement is in browser i want to type www.amazon.com so,some data
is
passing through the server.In the mean time i want to check this data the
passing data is valid data or not i want check it.
This is my requirement.
So,i have decided to create one proxyserver,Thi s behaves like hook
between
target server and client machine.
your question is which protocol is used in this server?HTTP
Please help me the structure of the proxyserver for HTTP protocol?
How can i implement this task in c#.net?
What assemblies are supported in c#.net?
Kindly suggest me.

Thanks in advance
TulasiKumar

"Me" <me@home.com> wrote in message
news:BP******** *************** *******@comcast .com...
> It would help to know what protocol you are wanting to create a proxy

for.
>
> HTTP? Some raw socket protocol? A very abstract database (SQL Server,

MySQL,
> etc) type of protocol?
>
> The reason for this is that there may already be a standard way of

creating
> a proxy for some of them (HTTP).
>
> Also if this is HTTP is SSL being used? If so then you are not looking

at an
> easy solution at all since you will need to also code in the HTTPS

stuff
for
> your proxy and the client would get a message stating that the secure
> connection has been breached (well.. at least a message stating that

the
> server is not who they say they are.)
>
> More information on this would be helpfull to us all though so if you

could
> give us some details that would be great. Maybe even a simple

walkthrough of
> what is happening?
>
> "TulasiKuma r" <tu*********@na nnacomputers.co m> wrote in message
> news:e$******** ******@tk2msftn gp13.phx.gbl...
> > hi all,
> > i have one requirement in my project.The requirement is i want to fix some > > domain sites in TcpIp like proxy servers behaviour.When ever end user
> > passing the inforamtion of that domain sites,at that time i want to get > > the inforamtion and i ahve do some operations.How can i implement this > > requirement? or What classes are supported in C#.Net? .Please give your > > suggestion.This requirement is very urgent.
> >
> > thanks in advance,
> > TulsaiKumar
> >
> >
> >
> >
> >

>
>


Jan 18 '06 #6
Me
Probably 2 different protocols.

HTTP for normal non-secure stuff
HTTPS for secure stuff

If you want to do an HTTP proxy then it really is not that difficult.
1. Accept a socket connection
2. Parse the HTTP request (ex. GET http://www.amazon.com:80/index.html
HTTP/1.0)
3. Connect to the actual destination (www.amazon.com port 80)
4. Send the request on to that server (GET index.html HTTP/1.0)
5. Read the reply back from that server
6. Send the reply back to the client

This is kind of a high level list of things that need to be done but it will
give you an idea of what it takes.

Now.. If you are using HTTPS (secure) then you are in a lot more work
because you have to deal with the whole SSL side of things. When an SSL
request is made from a browser to a proxy a different request is sent called
CONNECT. This tells the proxy server the IP and Port that the encrypted data
should be sent to.

Ex.)(not correct but it will give you an idea)
1. Browser connects to proxy
2. Browser sends CONNECT www.amazon.com:80 to proxy
3. Proxy decodes IP and Port from CONNECT request
4. Proxy connects to IP and Port
5. Browser sends encrypted data to proxy
6. Proxy sends encrypted data to server
7. Proxy reads encrypted reply from server
8. Proxy sends encrypted reply back to client

Notice that the data is encrypted and the proxy does not know what the data
is. This is because you are not allowed to view the data since that is what
SSL is used for. If you want to know what the encrypted data is then you can
perfrom all of the SSL handshaking yourself with the browser BUT the browser
will inform the client that something is not right. What this means is that
the browser will know that the person doing the handshaking is not
www.amazon.com because the SSL Server Certificate does not match the site
that is using it.

So.. How can you make a proxy... Well.. This is not something that is simple
to do in terms of a 1-2 day project if you want it to work correctly all the
time. You need to take into account several things when designing your
proxy and if you do not then you will be in trouble.

1. Multiple requests at the same time. Most browsers make several requests
at one time to a server by opening multiple socket connections. This helps
speed up the downloading times. You will want to make sure that you can
handle multiple requests at one time.

2. Keep Alive connections. Can you handle multiple requests/replies one
right after the other on the same connection? One socket connection could do
100's of request/replies before it is closed by the browser.

3. Closed connections. What about only 1 request and reply per socket
connection? There is no way to force the client or server to keep a
connection open after a request/reply is finished.

4. HTTP parsing is a must. If you are going to examine the data being sent
then you will need to learn the HTTP protocol or how it works at least so
you can extract your data. Is it a cookie, post data, part of the URL,
something else?

5. HTML parsing may be required. If the data you are looking for is not in
the HTTP request headers then it must be in the HTML body. You will need to
figure out how to parse/extract that data out as well and it could be
encoded somehow as well.

I am sure there are things I have missed but this should be enough to get
you thinking and on the right track. There are probably several solutions
out there already that will perform the proxy functions but the extra step
of "sniffing" the data will still need to be added by you.

Hope this helps!

"TulasiKuma r" <tu*********@na nnacomputers.co m> wrote in message
news:eV******** *******@TK2MSFT NGP14.phx.gbl.. .
Thank u for giving reply to me.
Hi Me
My requirement is in browser i want to type www.amazon.com so,some data
is
passing through the server.In the mean time i want to check this data the
passing data is valid data or not i want check it.
This is my requirement.
So,i have decided to create one proxyserver,Thi s behaves like hook
between
target server and client machine.
your question is which protocol is used in this server?HTTP
Please help me the structure of the proxyserver for HTTP protocol?
How can i implement this task in c#.net?
What assemblies are supported in c#.net?
Kindly suggest me.

Thanks in advance
TulasiKumar

"Me" <me@home.com> wrote in message
news:BP******** *************** *******@comcast .com...
> It would help to know what protocol you are wanting to create a proxy

for.
>
> HTTP? Some raw socket protocol? A very abstract database (SQL Server,

MySQL,
> etc) type of protocol?
>
> The reason for this is that there may already be a standard way of

creating
> a proxy for some of them (HTTP).
>
> Also if this is HTTP is SSL being used? If so then you are not looking

at an
> easy solution at all since you will need to also code in the HTTPS

stuff
for
> your proxy and the client would get a message stating that the secure
> connection has been breached (well.. at least a message stating that

the
> server is not who they say they are.)
>
> More information on this would be helpfull to us all though so if you

could
> give us some details that would be great. Maybe even a simple

walkthrough of
> what is happening?
>
> "TulasiKuma r" <tu*********@na nnacomputers.co m> wrote in message
> news:e$******** ******@tk2msftn gp13.phx.gbl...
> > hi all,
> > i have one requirement in my project.The requirement is i want to fix some > > domain sites in TcpIp like proxy servers behaviour.When ever end user
> > passing the inforamtion of that domain sites,at that time i want to get > > the inforamtion and i ahve do some operations.How can i implement this > > requirement? or What classes are supported in C#.Net? .Please give your > > suggestion.This requirement is very urgent.
> >
> > thanks in advance,
> > TulsaiKumar
> >
> >
> >
> >
> >

>
>


Jan 18 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3832
by: Charles Law | last post by:
This is going to seem like a basic OO question, but it comes up and bites me every now and again. Suppose we have a multi-tiered protocol to implement, what is the logical, OO way to design the handler? For example, let's say that we have to implement the ISO 7-layer protocol, or something like an Allen-Bradley master-slave protocol. At the lowest layer we might only need to top and tail the data being transported, such as DLE STX DLE...
2
4828
by: Billy Porter | last post by:
Greetings, I got a class that wraps the System.Data.SqlClient.SqlConnection class (no COM interaction). I'm not sure if I'm supposed to implement the IDisposable pattern for this wrapper or not. Since one of it's members (SqlConnection) implements this interface, I'm thinking maybe I ought to. But on the other hand, those unmanaged resources has already been wrapped in the SqlConnection class... If so, how would my Dispose method look...
4
3715
by: Sanjay Vyas | last post by:
Sorry, forgot to cross post this one.. This is rather unusual as we would expect any Collection class to implement ICollection interface and furthermore a Dictionary class should implement IDictionary interface. The StringDictionary class does implements all the methods of ICollection and IDictionary yet it does not list these interfaces. Am I missing something here or was it an oversight on the part of the class developer. Maybe I have...
4
17199
by: Peter | last post by:
I want to copy a parent class instance's all datas to a child's. It's actually a C++'s copy constructor. But why the following code does not work - there is a compile error! How it should look like? (The background is I don't know (I don't care indeed) all members in DataGrid, so I don't want to copy all members in DataGrid one by one.) public class GridEx : DataGrid { public GridEx()
3
2726
by: Brett Hall | last post by:
I have a VB.NET interface that my managed C++ code is to implement. I seem to be stuck implementing an event defined in that interface. Does anyone have a simple code snippet that will show me the basics of what I need to implement? I've seen all the MSDN articles on implementing events in managed C++ and I've gotten events to work without issue when implementing all the constructs
5
19601
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was having a problem in the calling program. I searched online and found suggestions that I return an Array instead so I modified my code (below) to return an Array instead of an ArrayList. Now I get the message when I try to run just my webservice...
7
15713
by: moondaddy | last post by:
If I'm in a class that inherits an interface, is there a shortcut key that will write the implementation of the interface into the class? I remember seeing something like this in vb.net. Thanks. -- moondaddy@nospam.nospam
0
2839
by: emin.shopper | last post by:
I had a need recently to check if my subclasses properly implemented the desired interface and wished that I could use something like an abstract base class in python. After reading up on metaclass magic, I wrote the following module. It is mainly useful as a light weight tool to help programmers catch mistakes at definition time (e.g., forgetting to implement a method required by the given interface). This is handy when unit tests or...
5
2416
by: Tony Johansson | last post by:
Hello! Assume you have the following interface and classes shown below. It is said that a class must implement all the methods in the interface it inherits. Below we have class MyDerivedClass that inherits IMyInterface but MyDerivedClass doesn't implement method DoSomething() it inherits it from the base class MyBaseClass. So the statement that a class must implement all method in an interface that
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10504
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10274
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.