Reputation: 8638
Is there any property in HttpRequest that can make sure if the request is a POST
request and it is coming from specific domain?
private bool IsRequestedFromDomain(string domain)
{
// Request.Form is from domain ?
return false;
}
Upvotes: 1
Views: 187
Reputation: 16168
HTTP Referer, but it can be modified.
Only way how to be sure is to send some , randomly generated value to form, store it to session, and in IsRequestedFromDomain compare it.
Upvotes: 1
Reputation: 12082
Use:
Request.UrlReferrer
, though it isn't reliable as it can be easily faked and may be changed by proxies.
Upvotes: 0
Reputation: 57946
Try to use
Request.ServerVariables["HTTP_REFERER"]
Note this header can be faked.
For a list of server variables, please take a look: ASP ServerVariables Collection
Upvotes: 1