Only allow specific domain access to web api

I have a web api that I created.

I want only a certain domain to be able to access this data; I do not want everyone to access it. Is this achievable? Is this recommended? How would I do this, or could someone point me in the right direction - articles, etc.

Thank you all

+4
source share
2 answers

There is built-in support for "CORS for ASP.NET Web API" version 2 (MVC5): http://aspnetwebstack.codeplex.com/wikipage?title=CORS%20support%20for%20ASP.NET%20Web%20API

+2
source

, , . , . , , .

:

var currentReferrer = HttpContext.Current.Request.UrlReferrer.GetLeftPart(UriPartial.Path);
if (currentReferrer != requiredReferrer)
{
            // Not the right domain.
}

, , :

HTTP Referer, , . Referer, , Referer, FTP HTTPS. Referer -, Referer . , Flash ( 9.0.18) Flash GET POST HTTP- CRLF Injection. [22] CRLF HTTP-.

: :

+1

All Articles