I want to visit this url
/thread/123
Where 123
is the thread id
.
I can't figure out how to set up my routes or whatever it is.
I thought to add thread
to my HomeController , but it appears that it only works if I go to /home/thread
.
How do I set up this project so the url /thread/123
will work?
I tried /thread
as a controller but it seemed like it thought 123
was an Action Method and the other attempt had thread be in Home rather then root.
You want to add a Route designated for this URI
routes.MapRoute(
"Thread", // Route name
"thread/{id}", // URL with parameters*
new { controller = "Thread", action = "Display", id = UrlParameter.Optional }
);
very important: Add your new route ABOVE the "Default" Route!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.