나는이 같은 자바 스크립트 코드가 있습니다Request.QueryString [ "path"]가 모든 + 기호를 공백으로 변환하는 이유는 무엇입니까?
function OnRequestComplete(result) {
// Download the file
//Tell browser to open file directly
alert(result);
var requestImage = "Handler.ashx?path=" + result;
document.location = requestImage;
}
및 Handler.ashx 코드는 다음과 같다 :
public void ProcessRequest(HttpContext context)
{
Context = context;
string filePath = context.Request.QueryString["path"];
filePath = context.Server.MapPath(filePath);
}
은 여기서 filePath에서 우리는 (대신 공간) 어떤 + 표시가 없습니다.
이 문제를 어떻게 해결할 수 있습니까?
Request.QueryString [ "path"]가 모든 + 기호를 공백으로 변환하는 이유는 무엇입니까?
확인이 답변 : http://stackoverflow.com/questions/123994/querystring-malformed-after-urldecode/124027#124027 –
의 QueryStrings 자신의 구문과 예약 문자가 있습니다. 직접 파일 이름을 인코딩하십시오. –