We are using File Upload to Folder. However, we found that the download links for files generated by ASPNETMAKER have shown an error, Bad Request - Invalid URL
HTTP Error 400. The request URL is invalid. Apparently this error occurs for files with names longer than 100 characters and/or that have many special character references.Are there any limitations for this feature? How to solve ?It is noteworthy that when we rename the files the code generated by ASPNETMAKER works normally.
Please make sure that you are using utf-8 project (HTML → Charset = “utf-8”) and the file name consists of utf-8 characters. Alternatively, show a problem file name.
yes, we are using utf-8 project (HTML → Charset = “utf-8”). Example of the filename causing the error:
CONTRATO PARCERIA POLO SÃO JOÃO DA PONTE-MG_Ctt_Parceria_SÃO JOÃO DA PONTE - MG_YDUQS - SANTA_CATARINA_.pdf
You may need to increase the maxAllowedContentLength / maxUrl / maxQueryString in web.config. For example:
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="..." maxUrl="..." maxQueryString="..." />
</requestFiltering>
</security>
In ASPNETMAKER in tools - advanced settings - option “encrypt file path” when disabling and regenerating the project the file url works.So I conclude that the problem is related to the file path encryption functionality.In which part of the ASPNETMAKER code can we check the logic of this functionality?
With encrypted file path, the URL will become a very long string, so that still points to the same problem per my previous reply .
You may need to increase the maxAllowedContentLength / maxUrl / maxQueryString in web.config.
The suggested solution did not solve the problem
Show your changes.
Michael,
the problem was worked around by applying the following configuration in the web config:<?xml version="1.0" encoding="utf-8"?>
<system.web>
</system.web>
<system.webServer>
</system.webServer>
If you use IIS, there is a limit from http.sys
Check the docs: https://docs.microsoft.com/en-us/troubleshoot/developer/webapps/iis/iisadmin-service-inetinfo/httpsys-registry-windows