简体   繁体   中英

How solve Error HTTP 404.15

my problem is when i try to do a request in ajax, at the moment to send the information i got this error:

The Request Filtering module is configured to deny a request when the query string is too long.

i saw the problem is the huge cuantity of information that i send through the GET request. someone has the solution to solve this problem?

here i leave an example from the ajax and the controller that i use

$.ajax({
        type: "GET",
        url: "@Url.Action("nuevaTarjetaCapacitacion", "TarjetaCapacitacion")",
        scriptCharset: "iso-8859-1",
        dataType: "json",
        contentType: "application/json; charset=iso-8859-1",
        data: {
            TarjetaCapacitacionId: $("#TarjetaCapacitacionId").val(),
            NombreCurso: $("#NombreCurso").val(),
            Descripcion: $("#Descripcion").val(),
            FechaInicio: $("#FechaInicio").val(),
            FechaFin: $("#FechaFin").val(),
            //TipoCurso: $("#TipoCurso").val(),
            Departamentos: tarjetaCapacitacion.Departamentos.toString(),
            Puestos: tarjetaCapacitacion.Puestos.toString(),
            Personal: tarjetaCapacitacion.Personal.toString(),
            Instructores: tarjetaCapacitacion.Instructores.toString(),
            InstructoresExternos: JSON.stringify(tarjetaCapacitacion.InstructoresExternos),
            Documentos: tarjetaCapacitacion.Documentos.toString(),
            AprobacionId: $("#AprobacionId").val()
        }


public JsonObject nuevaTarjetaCapacitacion(string NombreCurso, string Descripcion, string FechaInicio, string FechaFin, /*string TipoCurso,*/ string Departamentos, string Puestos, string Personal, string Instructores, string InstructoresExternos, string Documentos, int? AprobacionId)
    {
    }

You could use a POST instead of a GET. That way the data will in the request body of the HTTP request and not in the query string.

Check here: https://forums.asp.net/t/2024846.aspx?HTTP+Error+404+15+query+url+too+long

The request filtering module is configured to deny a request where the query string is too long. Looking at the Requested URL I see this:

http://localhost:51358/Account/Login?ReturnUrl=%2FAccount%2FLogin%3FReturnUrl%3D%252FAccount%252FLogin%253FReturnUrl%253D%25252FAccount%25252FLogin%25253FReturnUrl%25253D%2525252FAccount%2525252FLogin%2525253FReturnUrl%2525253D%252525252FAccount%252525252FLogin%252525253FReturnUrl%252525253D%25252525252FAccount%25252525252FLogin%25252525253FReturnUrl%25252525253D%2525252525252FAccount%2525252525252FLogin%2525252525253FReturnUrl%2525252525253D%252525252525252FAccount%252525252525252FLogin%252525252525253FReturnUrl%252525252525253D%25252525252525252FAccount%25252525252525252FLogin%25252525252525253FReturnUrl%25252525252525253D%2525252525252525252FAccount%2525252525252525252FLogin%2525252525252525253FReturnUrl%2525252525252525253D%252525252525252525252FAccount%252525252525252525252FLogin%252525252525252525253FReturnUrl%252525252525252525253D%25252525252525252525252FAccount%25252525252525252525252FLogin%25252525252525252525253FReturnUrl%25252525252525252525253D%2525252525252525252525252FAc count%2525252525252525252525252FLogin%2525252525252525252525253FReturnUrl%2525252525252525252525253D%252525252525252525252525252FAccount%252525252525252525252525252FLogin%252525252525252525252525253FReturnUrl%252525252525252525252525253D%25252525252525252525252525252FAccount%25252525252525252525252525252FLogin%25252525252525252525252525253FReturnUrl%25252525252525252525252525253D%2525252525252525252525252525252FAccount%2525252525252525252525252525252FLogin%2525252525252525252525252525253FReturnUrl%2525252525252525252525252525253D%252525252525252525252525252525252FAccount%252525252525252525252525252525252FLogin%252525252525252525252525252525253FReturnUrl%252525252525252525252525252525253D%25252525252525252525252525252525252FAccount%25252525252525252525252525252525252FLogin%25252525252525252525252525252525253FReturnUrl%25252525252525252525252525252525253D%2525252525252525252525252525252525252FAccount%2525252525252525252525252525252525252FLogin%2525252525252525252525252525252525253FReturn Url%2525252525252525252525252525252525253D%252525252525252525252525252525252525252FAccount%252525252525252525252525252525252525252FLogin%252525252525252525252525252525252525253FReturnUrl%252525252525252525252525252525252525253D%25252525252525252525252525252525252525252F

It seems like a redirect loop somewhere. I suspect something in the IIS Express config but I have no idea what it could be (it's basically the

$.ajax({
            type: "GET",
            url: "@Url.Action("nuevaTarjetaCapacitacion", "TarjetaCapacitacion")",
            scriptCharset: "iso-8859-1",
            dataType: "json",
            contentType: "application/json; charset=iso-8859-1",
            data: {
                TarjetaCapacitacionId: $("#TarjetaCapacitacionId").val(),
                NombreCurso: $("#NombreCurso").val(),
                Descripcion: $("#Descripcion").val(),
                FechaInicio: $("#FechaInicio").val(),
                FechaFin: $("#FechaFin").val(),
                //TipoCurso: $("#TipoCurso").val(),
                Departamentos: tarjetaCapacitacion.Departamentos.toString(),
                Puestos: tarjetaCapacitacion.Puestos.toString(),
                Personal: tarjetaCapacitacion.Personal.toString(),
                Instructores: tarjetaCapacitacion.Instructores.toString(),
                InstructoresExternos: JSON.stringify(tarjetaCapacitacion.InstructoresExternos),
                Documentos: tarjetaCapacitacion.Documentos.toString(),
                AprobacionId: $("#AprobacionId").val()
                   }
               });

 public JsonResult nuevaTarjetaCapacitacion(string NombreCurso, string Descripcion, string FechaInicio, string FechaFin, /*string TipoCurso,*/ string Departamentos, string Puestos, string Personal, string Instructores, string InstructoresExternos, string Documentos, int? AprobacionId)
        {
            Json("", JsonRequestBehavior.AllowGet)
        }

You should use return Json("", JsonRequestBehavior.AllowGet) instead of return Json("") otherwise you will get error "This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM