locked
Return Not Found From Controller RRS feed

  • Question

  • User338455301 posted

    Hi,
    in startup.cs i use this code to manage errors (404 , 500 , ...)
    and its worked correctly when i search a action thats not found and go to error action .

      app.UseStatusCodePagesWithReExecute("/"+CultureInfo.CurrentCulture.Name+"/errors/{0}");




    but in controller when a id is not exsist i use this code

    return NotFound();

    but its not work i want when i use NotFound its return to error action 

    Sunday, June 14, 2020 8:37 AM

All replies

  • User-17257777 posted

    Hi elahi1mahdi,

    I refer to this artical, and when I return NotFound(), it will display the custom error page with 404. 

    If it is not helpful to you, you can share us your error function.

    Best Regards,

    Jiadong Meng

    Monday, June 15, 2020 9:37 AM