I have a service that I access from jQuery on a page, it looks like this:
[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class FacadeService
{
ServiceHelper serviceHelper = new ServiceHelper();
[OperationContract]
[WebGet(ResponseFormat=WebMessageFormat.Json)]
public String GetAllProducts()
{
Uri uri = new Uri("http://localhost:12345/api/Products");
return serviceHelper.SubmitGetRequestToService(uri);
}
}
That's great, but anyone can now open a browser and hit this service. I want only the local website to be able to access this service. Is there any built-in way to do this or must I devise some clever scheme to keep out the riff-raff?