Reputation: 6029
I have a jquery Ajax method which listen for the onlick of a button, when its clicked it makes a call to the controller and passes in some parameters which then goes on to call the database.
When I click the button I see the following in the developer tool bar console.
http://localhost:37495/user/SetProfilePicture?pictureId=2&_=1434199801182
Is there a way I can encrypt that? so its un-readable, someone on another forum mentioned about writing a special route for this particular situation but I can't seem to find anything on the web.
Update
This is what my code looks like I have been looking at the following example: Encode/Decode URL Javascript
$('.profilebutton').on("click", function () {
var $this = $(this);
var url = '/user/SetProfilePicture?pictureId=' + $(this).attr("data-id") + '';
$.ajax({
url: encodeURIComponent(url),
//data: { "pictureId": $this.attr("data-id") },
cache: false,
type: "GET",
success: function (result) {
if (result.success) {
$("div.thumbnail").removeClass("Photoactive");
$this.closest("div.thumbnail").addClass("Photoactive");
}
},
error: function (result) {
alert("Sorry, can not set profile picture at this time");
}
});
return false;
});
But I get this error:
"NetworkError: 400 Bad Request - http://localhost:37495/user/%2Fuser%2FSetProfilePicture%3FpictureId%3D3?_=1434452450966"
Upvotes: 1
Views: 1674
Reputation: 1537
You can encrypt the contents, but not the URL. Re-write your ajax call to have all of your url parameters as part of the body. The body can be encrypted.
Upvotes: 1