Reputation: 986
I have controller
public class BilingController : Controller
{
…
[HttpPost]
public string Result (string data)
{
…
}
…
}
Method Result can be caused only by foreign service process.anypayservice.com
How can I check url, is request from service process.anypayservice.com or other service?
Or allow only this url - process.payservice.com for method Result call
Any attribute or I should write custom?
Upvotes: 0
Views: 151
Reputation: 499392
You can check the HTTP_REFERER
header, but note that it can be easily spoofed.
A better approach is to use some sort of token that can be passed in to your service for authentication.
Upvotes: 2