How to download a file with plus symbol(+) filename in IIS?

How to download a file with plus symbol(+) filename in IIS?

Original post link:https://www.cnblogs.com/markjiang7m2/p/10823844.html

Today I get a ticket with our client that they could not download a file with plus symbol(+) filename, such as the filename is a+b.xls.
I have a try and get the 404 code as below.
iis_file_404

Firstly, I consider if the file is deleted on the server by someone, so I remote to the server and have a check. But...all going well. The file is here.
Then I search if someone has had this problem on the Internet. A lot of answers say that + is a specific symbol in browser. It should be transcoded into %2B.
So I add the js code as below and try again.

fileName=fileName.replaceAll("\\+","%2B");
window.location.href = conf.webAPIRoot + fileName;

But...it doesn't work for me.

In another answer found in https://forums.iis.net/t/1226370.aspx. It should be set in IIS. After the setting, I try again and it works for me.

Request Filtering -> Edit Feature Settings -> Allow Double Escaping

iis_file_featureview

iis_file_requestfiltering

posted @ 2019-05-07 10:17  markjiang7m2  阅读(345)  评论(0编辑  收藏  举报
TOP