Why mozilla changes the characters when i use the .net mvc statement redirect?

129 views Asked by At

I'm trying to redirect to an external website when everything is done, but firefox changes the http word on the url for a weird set of characters. This is my server side code:

    [HttpPost]
    public ActionResult Postular(INFO_BASE_POSTULACION_model pInfoPostulacion) {
        string rutMD5 = Request["rutMD5"];
        int idRegion = Convert.ToInt32(Request["idRegion"]);
        int idInstrumento = Convert.ToInt32(Request["idInstrumento"]);
        string urlDestino = "";

        try
        {
            #region VALIDACION DE DATOS

            if (!ModelState.IsValid) {
                TempData["ModelState"] = ModelState;
                return RedirectToAction("Index", new { data = Utilidades.Base64Encode(rutMD5 + ";" + idRegion + ";" + idInstrumento) });
            }
            #endregion

            INFO_BASE_POSTULACION nuevaInfoBasePostulacion = new INFO_BASE_POSTULACION();
            nuevaInfoBasePostulacion = pInfoPostulacion.modeloToDTO(pInfoPostulacion);
            nuevaInfoBasePostulacion.TOKEN = Utilidades.GenerarStringUnico();
            nuevaInfoBasePostulacion.INFO_REGISTRO_ELIMINADO = false;
            nuevaInfoBasePostulacion.FECHA_CREACION = DateTime.Now;
            Boolean todoOK = new InfoBasePostulacionBO().Agregar(nuevaInfoBasePostulacion);

            if (!todoOK)
            {
                ModelState.AddModelError(String.Empty, "Ocurrió un error al intentar guardar la información.");
                TempData["ModelState"] = ModelState;
                return RedirectToAction("Index", new { data = Utilidades.Base64Encode(rutMD5 + ";" + idRegion + ";" + idInstrumento) });
            }

            string token = nuevaInfoBasePostulacion.TOKEN;
            string idFormulario = Convert.ToString(nuevaInfoBasePostulacion.ID_FORMULARIO_POSTULACION);
            string nombreParamToken = ConfigurationManager.AppSettings["ProActiveOffice-paramNombre-Token"];
            string nombreParamIdFormulario = ConfigurationManager.AppSettings["ProActiveOffice-paramNombre-IdFormulario"];
            urlDestino = ConfigurationManager.AppSettings["ProActiveOffice-URL"] + "?" + nombreParamToken + "=" + token + "&" + nombreParamIdFormulario + "=" + idFormulario;

            //Here i had yo use the uriBuilder because i couldn't make it work on any other way.
            UriBuilder uri = new UriBuilder(urlDestino.Trim());

                //Here i redirect to an external website.
            return Redirect(uri.Uri.ToString());
        }
        catch (Exception ex)
        {
            log.Error("Error al intentar guardar info base de postulación", ex);
            ModelState.AddModelError(String.Empty, "Ocurrió un error al intentar guardar la información.");
            TempData["ModelState"] = ModelState;
            return RedirectToAction("Index", new { data = Utilidades.Base64Encode(rutMD5 + ";" + idRegion + ";" + idInstrumento) });
        }

    }

Here you can see the debug:

1-Here you can see the url string that i have (i had to remove the "http://" because it wasn't working correctly with the uri builder):

enter image description here

2-Here you see the value of the uri builder with the string url in it:

enter image description here

3-Here you see the toString() method apply to the uri (I have already use the absolute uri property):

enter image description here

4-And now finally the error. The http word has been change for a set of characters:

enter image description here

I have had lots of problems with the redirection. These code is currently working on Chrome, but on firefox gives me these error.

What could it be ?

By the way i am using visual studio 2013 + .NET Framerowk 4.5 + MVC4

1

There are 1 answers

2
Cᴏʀʏ On BEST ANSWER

%E2%80%8B is a URL-encoded, UTF-8 encoded ZERO-WIDTH SPACE character. You likely have one hiding in your application setting file for the ProActiveOffice-URL value. It was maybe pasted in that way, if you copied the URL from somewhere.