I have a webservice written in c#. I simply want to handle (intercept) all connection attempts in order to validate the client IP.
How do you handle a connection attempt in a webservice?
Printable View
I have a webservice written in c#. I simply want to handle (intercept) all connection attempts in order to validate the client IP.
How do you handle a connection attempt in a webservice?
you generally wrap the connection in a try / catch block. That way you can thow or ignore any errors. And you can put your ip validation method in the try part and if it fails you can throw it to the catch part.
hth,
mcm
Ok. That's good, but how do I even detect that there is a connection attempt. Something like...
So how do you intercept a connection attempt? Where does it come from?Code:myService.OnConnection += new ConnectionHandler(handleConnect);
private void handleConnect()
{
//handle connection here
}
check this:
http://www.systinet.com/doc/ssj-65/a...llContext.html
maybe it will help.
I'm curious how people out there handle connection attempts to the webservices. Certainly there must be some way to intercept a connection request and either allow or deny? Right?