I want to block access to a url from everything except for iis usr that requests the image.
So I have: www.myurl.com/somedirectory/myfile.ashx
I want only my requests from code behind to be able to access this file not users/bots/non-clients who can manually visit the file by going to the url.
Need to take into account that servers are load-balanced I am unsure if this will cause an issue.
How would I go about doing this.
Requested serverside:
HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(imageUrl);
httpRequest.Method = "GET";
httpRequest.UserAgent = "MobileQ.NET";
httpRequest.ContentType = "image/png";
response = httpRequest.GetResponse().GetResponseStream();
You can check in your
myfile.ashxif the request is fromlocalhost: