0

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 ?

1 Answer 1

0
Sign up to request clarification or add additional context in comments.

2 Comments

Hey @Arunprasanth, is your issue fixed?
No , I dont see any information in your ans , its all just regular url related to encoding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.