I'm calling a rest endpoint with ajax that is like this. It takes two params user and permission
$.ajax({
type: 'GET',
cache: false,
url: "/app/Rest/4.0/UserManagement/AddPermissionToUser",
data: {
username: encodeURI(user),
permissionName: encodeURI(permission)
},
success: function (msg) {
//do stuff
}
});
In the javascript, let's say may user is something like domain\user1, the ajax request strips out the backslash character. Originially I didn't have the encodeUri()'s in there
One more curious thing is that if I manually stick this url in my browser encoding it like this domain%5Cuser1 it works as expected. I am in IE 11, is the browser stripping this off, or is it a problem with jQuery? Any ideas?
The \
may be seen as being used to escape special characters server-side.
Try passing a string like domain\\user1
, to see if it comes through as a single slash.
It's possible there is a better solution, but we would need to see what you're doing with the string in your server-side code.