2 votes

Error: No resource with given URL found, 500 (Internal Server Error) asp.net mvc

I have the following code which sends an array with the data of my HTML table to the controller to update them in the database, so far so good, the problem is that it shows the error: Error: No resource with given URL found, 500 (Internal Server Error) asp.net mvc

I clarify that both functions (ajax and the controller's one) are repeated for each row of my table.

        function GuardarF() {
        $.ajax({
            type: 'POST',
            dataType: "json",
            url: '/MyController/MyView',
            traditional: true,
            data: {
                  array: array
            },
            success: function (data) {
                if (data.rstProceso === "true") {
                    console.log('Exito: ' + data.rstMensaje);
                } else if (data.rstProceso === "false") {
                    console.log('Algo salió mal ' + data.rstMensaje);
                }
            },
            error: function (jqXHR, status, err){
            console.log(jqXHR.responseText);
            }
        });
    }

MyController

[HttpPost]
public ActionResult MyView(int[] array)
{
  JsonResult dtaEjecucionTarea = default(JsonResult);
        dtaEjecucionTarea = Json(new
        {
            rstProceso = "false",
            MessageGestion = "Error, algo salió mal, intente de nuevo"
        });

        if (Update_MyView(array))
        {
            dtaEjecucionTarea = Json(new
            {
                rstProceso = "true",
                MessageGestion = "Cambios guardados con éxito"
            });
        }
  return View(dtaEjecucionTarea);
}

public bool Update_MyView(int[] array)
{
   if (array != null)
   {
    //my code
    bd.SaveChanges();
    return true;
   }
   else
   {
    return false;
   }
}

1 votes

Could you exemplify the error you have or post some image to better understand what you are trying to do? I have a lot of doubts when I want to help you.

0 votes

You declare _column3, but in the switch you carry column3, could you check that on one side ?

0 votes

You are getting something in the int[] array of the MyView Action.

1voto

user113905 Points 1

I had a similar thing happen to me only it doesn't load any img or .js file. in an asp project in c# when i changed the port of the application it took me a day to find the error I caught it in web.config commented the code and it was fixed.

<!--
<authorization>
  <deny users="?"/>
  <allow users="*"/>
</authorization>
-->

0voto

I would recommend that the MyView function return a JSon, with affirmative or negative information of the task execution, so that the success function of JQuery-Ajax obtains this information and processes it, for example:

--
--  JavaScript
--

function Guardar() {
    $.ajax({
        type: 'POST',
        dataType: "json",
        url: '/MyController/MyView',
        traditional: true,
        data: {
              array: array
        },
        success: function ( data ) {
          if (data.rstProceso === "true") {
            console.log( 'Exito: '+ data.rstMensaje );
          }else if(data.rstProceso === "false"){
            console.log( 'Algo salió mal '+ data.rstMensaje );
          }
        },
        error: function () {
            console.log('algo salió mal');
        }
    });
}

--
--  ASP - MVC
--

[HttpPost]
public JsonResult MyView(int[] array)
{
  JsonResult dtaEjecucionTarea = default(JsonResult);
  dtaEjecucionTarea = Json(new{
      rstProceso = "false",
      MessageGestion = "Error, algo salió mal, intente de nuevo"
  });

  if( Update_MyView(array) )
  {
    dtaEjecucionTarea = Json(new{
      rstProceso = "true",
      MessageGestion = "Cambios guardados con éxito"
    });
  }

  return dtaEjecucionTarea  
}

HolaDevs.com

HolaDevs is an online community of programmers and software lovers.
You can check other people responses or create a new question if you don't find a solution

Powered by:

X