I do not know why I constantly struggle with it, but no one can tell why it does not work is? From: When you define a route, you can provide a default value for a parameter. The original value is used if the value for that parameter is not included in the URL. You set the default value for a root by specifying the default values for an object to the root class. I do not know that it does not follow this rule: (predefined), "{controller} / {action} / {id}", new {controller = "Home", Action = "Index", Id = UrlParameter.Optional}); } I read this: Am I missing something or is this unnecessary confusing and silly? I have always found MVC3 routing problematic but have accepted it then I started playing with rail and node frameworks and now they are ridiculously simple routing. NIT MVC now annoys me when it does not work or does not use complex patterns. Someone asks for a reference, when I browse on You are definitely doing something wrong or some code that you Paradise is not followed by following these steps: Change the contents of Hit F5 What Happens Here: Actually Expected, right? / redirects
/ from
home controller
/ .
/ Gallery / A 404 error has not been found.
/ gallery / index
index is the action of
gallery controller.
controller is defined,
home Use
verb is not defined , then use
index .
gallery and no action is included in the URL so that it should go to
index .
/ gallery / index then my gallery controller, action and view are all defined and working. Public Category GalleryController: Controller {Public Performance Index} {View Return (); }}
HomeController.cs with:
Public Class Home Controller: Controller {Public Performance Index} {Return Content (" Home / index "); }} Public Class Gallery Controller: Controller {Public Performance Index} {Return Content ("Gallery / Index");
request url | Results ----------------- + --------------- / | Home / Index / Home | Home / Index / Home / | Home / Index / Home / Index | Home / Index / Home / Index / | Home / Index / Gallery | Gallery / Index / Gallery / | Gallery / Index / Gallery / Index | Gallery / Index / Gallery / Index / Gallery / Index
Comments
Post a Comment