我的Api不接受特殊字符,因为访问控制器允许原点不接受,因此彻底出错
我的文件名为Hello{#$^%.net}.pdf
我的网址格式
http://localhost:5300/api/Insert/DeleteRec/1-1920-9/36/Hello%7B#$^%.net}/pdf
我的Angular代码
fac.DeleteRecFromTemp = function (EnqId, UId, FileName,exten) {
var fixedstring = decodeURIComponent(escape(FileName));
return $http({
url: hostapiUrl + 'Inser/DeleteRec/'+EnqId+"/"+UId+"/" +fixedstring+"/"+exten,
method: "DELETE",
headers: { 'content-type': 'application/json' }
})
}
请帮助我如何将该URL转换为浏览器URL
答案 0 :(得分:1)
尝试一下:
url = encodeURI(url)