Articles → ASP .NET MVC → Ignoreroute Function In Asp.Net MVC

Ignoreroute Function In Asp.Net MVC






Purpose





Sample Project




  1. Create an asp.net MVC application
  2. Create a folder ‘Employee’ inside ‘Views’ folder. Inside the folder add couple of views (see the screen shot below)
  3. Picture showing the View files inside the Employee folder

    Click to Enlarge

  4. Add a file ‘EmployeeController’ inside the ‘Controller’ folder
  5. Picture showing adding the EmployeeController inside the Controller folder

    Click to Enlarge

  6. Inside the ‘EmployeeController’, add following methods
  7. Picture showing the code inside the EmployeeController

    Click to Enlarge

  8. Build the application to make sure there is no compile time error.

Check Views Without Ignoreroute Function




Picture showing old and new views without IgnoreRoute function

Click to Enlarge


Ignoring Routes




Picture showing adding the IgnoreRoutes code in the RouteConfig file

Click to Enlarge



Picture showing the error displayed when user is trying to navigate to the old view

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Thursday, March 23, 2017

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250