HttpContext is null when the request does not come from the browser

We have a server application that loads into the IIS workflow. When we request the browser URL, our application can see the current httpcontext, but it is null when we use a tool that sends some download requests using the .net WebRrquest.Create method.

We are trying to decide that when a request comes from our tool, we send additional parameters to its headers so that our application on the server can understand that this request requires some special processing.

What should be the approach we should follow?

+4
source share
2 answers

Do you find using SimpleWorkerRequest

See an example here.

+3
source

Is the HTTP activation request or is it faked inside the IIS process? I would recommend using HttpWebRequest (or simpler: WebClieny) so that your request is fully valid. You can still set headers, etc.

At the simplest level:

using(var client = new WebClient()) { // add headers etc client.DownloadString(url); } 
+1
source

All Articles