Lets say that I am no https://localhost/My-cool-page?color=blue&brand=ferrari and from that page I make a post request to my backend https://localhost/api/getCars
how do I from the http request find out that the request came from the page https://localhost/My-cool-page?color=blue&brand=ferrari
and not localhost as the origin of the httprequest states?
CodePudding user response:
I think you are looking for the referer. You can do this
string referer = Request.Headers["Referer"].ToString();