passing url in parameters mvc4
Posted
by
user516883
on Stack Overflow
See other posts from Stack Overflow
or by user516883
Published on 2012-10-11T15:23:33Z
Indexed on
2012/10/11
15:37 UTC
Read the original article
Hit count: 253
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) {
}
});
});
© Stack Overflow or respective owner