ProgrammerGuide.Net | Step by Step Programmer Guide

How to Override the Common Route Prefix? | ASP.Net MVC Interview Question

  • You can use a tilde (~) on the method attribute to override the route prefix
  • Well,It’s like this : [Route(“~/PetBooking”)]
       
        BookingController.cs

    [RoutePrefix(“Booking”)]
    public class BookingController : Controller
    {
        // eg: /PetBooking
        [Route(“~/PetBooking”)]
        public ActionResult PetBooking() { return View(); }
    }



Above Route on Browser is as below



Please click here for related products on Amazon!

Jayashee

Add comment

Want to Check Celebrities News?