javascript - Filepaths containing ampersand (&) character -


i have asp.net mvc web app includes facility clients upload/download documents folder on server.

i'm having problem people uploading file names containing ampersand character (possibly other characters too, 1 i've discovered far).

the result i'm getting javascript redirects looking like:

window.location.href = 'mycontroller/downloaddocument?filename=dog & cat.pdf';  

which doesn't work.

what's easiest work around this? there way escape ampersand in query string?

use encodeuricomponent (which fix problem of spaces, aren't allowed in uris)


Comments