Previously I had url as below:
http://xyz.in/Modules/kOPYWOeJHOjPM04ejG%2faRA%3d%3d
and it used to give me error saying resource not found (because %2f in url, it is getting decoded by MVC), but when I do it like below:
http://xyz.in/Modules/id=kOPYWOeJHOjPM04ejG%2faRA%3d%3d
(added id= before parameter value) then it works fine.
I want url to work without mentioning id (parameter name). Can I even achieve it?
Update:
Routing rule is as below:
routes.MapRoute(
name: "Modules",
url: "Modules/{id}",
defaults: new { controller = "Modules", action = "Modules", id = UrlParameter.Optional }
);
and controller code:
public class ModulesController : Controller
{
public ActionResult Modules(string id)
{
var topic = new Topic();
return View("Modules", topic.GetTopicWithModules(HttpUtility.UrlDecode(id)));
}
}