How to stop asp.net from downloading a published file

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; } 
+4
source share
1 answer

The problem you are facing is that IIS completely uploads the file to the workstation before your application receives the request.

IIS asp.net mvc partial? file upload

If you really want to control the size and type of file (extension), you will need to use the async download process. I got lucky with uploadify.

http://www.uploadify.com/

+1
source

Source: https://habr.com/ru/post/1333366/


All Articles