TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Prafulla Sahu
NA
213
22.2k
Attribute based routing is not working
Jan 3 2018 9:31 AM
Hi I have created a small demo application to test Attribute based routing but no luck till now. Need some suggestions.
Route.config class
public
class
RouteConfig
{
public
static
void
RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute(
"{resource}.axd/{*pathInfo}"
);
routes.MapMvcAttributeRoutes();
routes.MapRoute(
name:
"Default"
,
url:
"{controller}/{action}/{id}"
,
defaults:
new
{ controller =
"Home"
, action =
"Index"
, id = UrlParameter.Optional }
);
}
}
TestingController
public
class
TestingController : Controller
{
// GET: Testing
[Route(
"demo"
)]
public
ActionResult Index()
{
return
View();
}
public
ActionResult products()
{
return
Content(
"All products"
);
}
}
This is a simple demo program only but banging my head to figure out why it is not working.
For your reference I am using visual studio 2015.
http://localhost:1352/Testing/products:
This one is working
http://localhost:1352/Testing/demo :
This one is not working
Please suggest something.
Reply
Answers (
2
)
ASP.NET MVC 5 : System.ArgumentNullException on DropDownList
How to Insert all countries names with their values into DB