我有哪些选择呢?例如,要将特定操作中上传的文件大小限制为5MB,我向webconfig添加了以下部分:
<location path="home/fileupload">
<system.web>
<!-- maxRequestLength is in kilobytes (KB) -->
<httpRuntime maxRequestLength="5120" /> <!-- 5MB -->
</system.web>
<system.webServer>
<security>
<requestFiltering>
<!-- maxAllowedContentLength is in bytes -->
<requestLimits maxAllowedContentLength="5242880"/> <!-- 5MB -->
</requestFiltering>
</security>
</system.webServer>
</location>
在webconfig中是否有设置允许文件类型白名单的选项?或者唯一的选择是在文件完全上传时在代码中验证文件类型?推荐使用哪种技术?如何确保.docx,.pdf,.jpg等文件确实是它们所表示的内容?