tags:

views:

46

answers:

2

Is there a way in a WCF Rest Service implementation to require one method be called over https, while allowing others to be called over http or https without having to define two service endpoint bindings? I want to be able to do something in my service implementation such as:

if (CalledOverHttps()) {
   //Do Stuff
} else {
   throw new WebOperationException("Nice try buddy");
}

Thanks in advance!

A: 

I'm not entirely sure, but I believe you can configure it in the bindings.

I have to look it up, though.

Paulo Santos
I'm not sure this is an answer...
Rubens Farias
A: 

I handled this with IIS, and requiring https on a virtual directory. So in my directory structure i have:

non secured: http://foo.com/someservice.svc

secured: https://foo.com/secure/someservice.svc

and if you tried http://foo.com/secure/someservice.svc, an appropriate 500 error is thrown by IIS.

Mike