RedirectToAction($ActionName/{Id};) after its execution something replace / by %2F , and not found page

  • Thread starter Thread starter Andres Villa
  • Start date Start date
A

Andres Villa

Guest
Hi


I have a project in ASP Net Core 3.1. MVC.

The startup file contains:


app.UseStatusCodePagesWithReExecute("/error/{0}");

app.UseHttpsRedirection();

app.UseStaticFiles();

app.UseAuthentication();

app.UseCookiePolicy();


app.UseRouting();

app.UseAuthorization();


app.UseRequestLocalization("en-UY", "fr-FR");


app.UseEndpoints(endpoints =>

{

endpoints.MapControllerRoute(

name: "default",

pattern: "{controller=Home}/{action=Index}/{id?}");

});



I have a Controller "Countries", into it include an action named "Details" showing for each country their cities, in a view with the CountryId. When I add a new city, after save it I call the next sentence:


return this.RedirectToAction($"Details/{countryId}");


I display its value with debugger and show "https://localhost:44304/Countries/Details/5", that is correct,


but when the application go to the URL show "https://localhost:44304/Countries/Details/5"


and display error 404 page not found.


Why change "/" by "%2F" ?


I think that this problem is related with something in configuration of the project but I not found in Google a similar problem.


I appreciate any help!

Continue reading...
 
Back
Top