Hy!
I have this controller:
public ViewResult Hotel(string hotelSupplierCode, bool displayAllRooms, bool resend)
{
HotelModel model;
if (resend)
{
model = (HotelModel)Session["HotelDetails"];
HotelManager.ResendHotel(model.Hotel.Id);
model.Hotel.Status = 1;
}
else
{
model = HotelModel.GetGotel(hotelSupplierCode, displayAllRooms);
}
Session["HotelDetails"] = model;
return View("Hotel", model);
}
and this route:
routes.MapRoute(
"Hotel", // Route name
"{controller}/{action}/{hotelSupplierCode}/{displayAllRooms}/{resend}", // URL with parameters
new { controller = "Hotel", action = "Hotel", hotelSupplierCode = UrlParameter.Optional, displayAllRooms = UrlParameter.Optional, resend = UrlParameter.Optional }
The problem is that when I access the view the returned URL is soemthing like that:
http://localhost:49575/Hotel/Hotel?hotelSupplierCode=3711&displayAllRooms=False&resend=False
but I want something like that:
http://localhost:49575/Hotel/Hotel/3711/False/False
So how I can hide the atribute names? If i put the second URL manualy it works fine.
I suspect that your issue is due to the order of your routes. Routes must be placed in order from the most specific to the most general, usually ending with the default route defined in a new project.
Make certain that you place the Hotel route before the default route.