मैं उम्र के लिए ढेर खोज की है, MSDN डॉक्स पढ़ सकते हैं और बिंग थे, लेकिन नहीं देख सकते हैं क्यों यह काम नहीं करेगा! मैं मार्गों + नीचे प्रासंगिक कोड मिल गया है। मार्ग Browse
काम करता है कहा जाता है ठीक है, लेकिन Details
मार्ग के लिए productCode
परम हमेशा कुछ भी नहीं के बराबर है। अगर मैं किसी भी mods बनाने मैं हो रही है 'संसाधन नहीं मिला' 404 पृष्ठ रखने के लिए।ASP.NET MVC4 मार्ग मुद्दा
' Lives in controller called 'Details'
' Usage: site.com/details/abc123
Function Index(productCode As String) As ActionResult
' Lives in controller called 'Browse'
' Usage: site.com/browse/scifi/2
Function Index(genre As String, Optional page As Integer = 1) As ActionResult
मार्ग हैं: जब आपके मार्गों को परिभाषित करने
routes.MapRoute(_
"Browse", _
"{controller}/{genre}/{page}", _
New With {.controller = "Browse", .action = "Index", .id = UrlParameter.Optional, .page = UrlParameter.Optional}
)
routes.MapRoute(_
"Details", _
"details/{productCode}", _
New With {.controller = "Details", .action = "Info", .productCode = UrlParameter.Optional}
)