471,306 Members | 1,290 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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 2021

"TulasiKumar" <tu*********@nannacomputers.com> wrote in message
news:e$**************@tk2msftngp13.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?

"TulasiKumar" <tu*********@nannacomputers.com> wrote in message
news:e$**************@tk2msftngp13.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****************@TK2MSFTNGP14.phx.gbl...

"TulasiKumar" <tu*********@nannacomputers.com> wrote in message
news:e$**************@tk2msftngp13.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,This 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?

"TulasiKumar" <tu*********@nannacomputers.com> wrote in message
news:e$**************@tk2msftngp13.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)

"TulasiKumar" <tu*********@nannacomputers.com> wrote in message
news:eV***************@TK2MSFTNGP14.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,This 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?
>
> "TulasiKumar" <tu*********@nannacomputers.com> wrote in message
> news:e$**************@tk2msftngp13.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!

"TulasiKumar" <tu*********@nannacomputers.com> wrote in message
news:eV***************@TK2MSFTNGP14.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,This 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?
>
> "TulasiKumar" <tu*********@nannacomputers.com> wrote in message
> news:e$**************@tk2msftngp13.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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Billy Porter | last post: by
4 posts views Thread by Peter | last post: by
7 posts views Thread by moondaddy | last post: by
reply views Thread by emin.shopper | last post: by
5 posts views Thread by Tony Johansson | last post: by

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.