'ampersand symbol in url param, after encoding also throwing an error - MVC
In one of my action methods , I do have a parameter "filename", which some times can be a string with ampersand symbol. The problem is when ever we have an ampersand symbol its not hitting the method.
I have encoded the url but still its not hitting.
var renderDetailLink = function (data, type, row, meta) {
            var url = '@Url.Action("DocDetails", "Docs", new { docKey = "__docKey__", isReleased = "__isReleased__", isFilterDocs = "__isFilterDocs__", fileName = "__fileName__" })';
            url = url.replace('__docKey__', row.X);
            url = url.replace('__isReleased__', row.Y);
            url = url.replace('__isFilterDocs__', row.Z);
            url = url.replace('__fileName__', encodeURIComponent(row.FileName) + "/");
            var link = "<a href='" + url + "'>" + data + "</a>";
            return link;
        }
The above is the javascript method which i am using to encode the url part.
        [HttpGet]
        [Route("DocDetails/{docKey}/{isReleased}/{isFilterDocs}/{*fileName}")]
        public ActionResult DocDetails(long docKey, string isReleased, bool isFilterDocs, string fileName)
        {
          ///
            return View();
        }
My controller action looks like above.
In few places I have read, by encoding the url we can pass &, but in few other places I saw since .net engine restricts & we cannot simply pass it by encoding it.
Any help on this ?
Solution 1:[1]
Similar kind of SO fixed here.
Some of the useful links here for URL Encoding.
Accessing URL Parts from a Rewrite Rule.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | TechieWords | 
