0
Hello, I have the following route:
routes.MapRoute("RelatorioDemonstrativoResultadoExercicio", "downloads/relatorios/Relatorio_DRE_{dataInicio}_{dataTermino}.pdf", new { controller = "RelatorioFinanceiro", action = "DemonstrativoResultadoExercicio" });
I use it to create a PDF and download it to the customer.
The problem is that it stopped working. I updated the MVC and simply stopped.
He can’t track the controller or anything else.
But if I do so:
routes.MapRoute("RelatorioDemonstrativoResultadoExercicio", "downloads/relatorios/Relatorio_DRE/{dataInicio}/{dataTermino}", new { controller = "RelatorioFinanceiro", action = "DemonstrativoResultadoExercicio" });
it comes back to work.
Does anyone know what happened? What should I do for my old route to work?
Below is the Controller that should be triggered:
public void DemonstrativoResultadoExercicio(DateTime dataInicio, DateTime dataTermino)
{
dataInicio = dataInicio.Date;
dataTermino = new DateTime(dataTermino.Year, dataTermino.Month, dataTermino.Day, 23, 59, 59);
BancoDadosBO db = new BancoDadosBO();
RelatorioFinanceiroCO.DemonstrativoResultadoExercicio(Response.OutputStream, db, idContaSistema, idUsuario, dataInicio, dataTermino);
db.Commit();
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment");
Response.End();
}
If I understood correctly the only difference in the two routes is the
.pdf
, right? Are you not putting thedataTermino
with the.pdf
? Or what you’re adding to your action?– CesarMiguel
When debugging his controller, can you at least stop inside the Action? If yes, the parameters are filled in correctly?
– Leonel Sanches da Silva
@Ciganomorrisonmendez, it doesn’t even stop at the controller
– 00lenon
@Cesarmiguel, I did not test the route without the . PDF, but the strange thing is that before, in MVC3, it worked.
– 00lenon
P.s: I added the Controller to the question.
– 00lenon