简体   繁体   中英

Can I intercept a file upload over HTTP to IIS7 and deny the upload based on a validation criteria?

I have a form which you can post a file over to my server.

Is there a way, without using a custom HTTP handler, to intercept the start of the post and prevent it before the file is uploaded and bandwidth used up.

So for example, I could check an IP address and if it's blocked in my system I could stop the request before I waste 10MB of uploading.

Thanks!

EDIT:

I'm using ASP.NET MVC

据我所知,使用股票.NET代码是不可能的,除非您花时间重新创建文件处理并解析ASP.NET。

This is really a job for a HttpModule, not a HttpHandler. Just check remote IP against a blacklist in the BeginRequest event and null route or what have you.

在ASP.Net 2.0中,添加了一个新的FileUpload控件 ,该控件可用于限制文件类型和大小等。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM