passing url in parameters mvc4
- by user516883
I have a site that collects urls. A full http url is enter into a texbox. I am getting a 400 error when a url is being passed in the parameter, It works fine with regular text. Using jquery how can I pass the full URL in my application. Thanks for any help.
MVC Routing Config
routes.MapRoute("UploadLinks", "media/upload_links/{link}/{albumID}",
new { controller = "Media", action = "WebLinkUpload" });
Controller Action
public ActionResult WebLinkUpload(string link, string albumID){}
Jquery ajax call
$('#btnUploadWebUpload').click(function () {
$.ajax({
type: "GET",
url: "/media/upload_links/" + encodeURIComponent($('#txtWebUrl').val().trim()) + "/" + currentAlbumID,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
}
});
});