I am developing httpHandler in my source code, if some conditions are not met, I would like to stop uploading the file to the server (for example, the file extension is not allowed)
When I try to exit the ProcessRequest function using return null; , asp.net tries and automatically downloads the file before I exit httpHandler ...
How can I stop asp.net to automatically download published files?
Here is a list of things I've tested so far and you are out of luck:
public void ProcessRequest(HttpContext context) { var worker = (HttpWorkerRequest)provider.GetService(typeof(HttpWorkerRequest)); .......... worker.CloseConnection(); context.Response.End(); Environment.Exit(0); return null; }
source share