开发者

How to make asp.net routing use a different application path

开发者 https://www.devze.com 2023-01-20 21:50 出处:网络
In an asp.net mvc application, I would like to be able to generate views, where the routing engine will cre开发者_如何学Pythonate all URLs that point to a different site, i.e. change the application p

In an asp.net mvc application, I would like to be able to generate views, where the routing engine will cre开发者_如何学Pythonate all URLs that point to a different site, i.e. change the application path.


Can't be done with standard routes. Routing is intended to generate URLs within the current application. After all, if you generate URLs outside your application, routing has no idea that something will be there to match the route.

You either can write your own custom routes that derive from Route (or RouteBase) and do the logic yourself, or use IIS URL Rewriting.

0

精彩评论

暂无评论...
验证码 换一张
取 消