How to pass a parameter to the controller that contains / (bar)

Asked

Viewed 200 times

0

I need to pass a parameter to a Controller, however, this parameter contains / (bar).

Example:

  1. 5701/1_1
  2. 5966/2_5
  3. 7881/6_1

To pass the parameter I’m using @Url.Action:

 @Html.ActionLink("Visualizar", "DetailsRaWeb", new { id = item.TAG })

But, when executing the error is generated:

inserir a descrição da imagem aqui

  • Have you tried with Htmlencode? https://msdn.microsoft.com/pt-br/library/73z22y6h(v=vs.110). aspx

  • @Aline I tried to follow your tip, but the error continues, I used: @Html.ActionLink("Visualizar", "DetailsRaWeb", new { id = HttpUtility.HtmlEncode(item.cod_item_CRM) })

  • 1

    You could not replace it with another character and replace it in the controller?

  • @Thiagoaraújo replace? vc says, replace in view, and in controler change to / (bar)?

  • this... vc would send instead of a bar, a character like '#' for e.g. And in Controller, would replace string.Replace("#", "/");

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.