0

i want to redirect from on page to another on mvc and pass some parameter and get them on second page.

my parameter is something like this

?id=UXodaA54Iqo+gId3avkIqA

but when i get this parameter on the second the page some characters like "+" removed and the parameter has been changed to this

    UXodaA54Iqo gId3avkIqA

my action is

    [ValidateInput(false)] 
    public ActionResult test(string id)
    {
        return view();
     }

what is the best way to handle it just for this action because i do not want to put some thing like this on my web config

  <httpRuntime requestValidationMode="2.0" />
motevalizadeh
  • 5,244
  • 14
  • 61
  • 108

1 Answers1

2

This is not releated to validation. A + character in a query string parameter is seen as a space. Use HttpUtility.UrlPathEncode() to encode your parameter.

Community
  • 1
  • 1
CodeCaster
  • 147,647
  • 23
  • 218
  • 272