Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Created Unassigned: URL Smart Generation (ActionLink, etc) [1292]

$
0
0
I've currently run into a scenario where I'd like to re-use much of an existing controller and not have to worry about creating new files.

In my area registration on an MVC3 website I have the following code:

```
context.MapRoute(
"AdminMdsWebRule",
"Admin/MDS/WebRule/{action}/{id}",
new { action = "Index", controller = "WebRule", id = UrlParameter.Optional, interfaceModel = typeof(UIAssessment) },
new string[] { "WebUI.Controllers" }
);

context.MapRoute(
"AdminUBWebRule",
"Admin/UB/WebRule/{action}/{id}",
new { action = "List", controller = "WebRule", id = UrlParameter.Optional, interfaceModel = typeof(MasterUBClaim) },
new string[] { "WebUI.Controllers" }
);
```

Essentially this uses the pattern matching feature to properly point to the same controller in the base of the application, it also uses this opportunity to create a route value that identifies a class type to be used as an interface.

The issue comes when the Helpers are generating URLs, because the route map has two entries with the same controller name, when the url is generated it takes the first one and uses that as the source for generating the url.

It would be nice if it tried to apply the pattern matching to instances where multiple paths are possible.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>