如何更改.net core的URL后缀? [英] How to change URL Suffix of .net core?

查看:62
本文介绍了如何更改.net core的URL后缀?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用以下路线:

http://localhost:4413/abc/

以及以下路线:

http://localhost:4413/abc.html

是否都使用.NET Core MVC返回相同的控制器方法?

both return the same controller method, using .NET Core MVC?

推荐答案

听起来您希望两个后缀达到相同的控制器操作.

It sounds like you want two suffixes to reach the same controller action.

  1. 后缀为空
  2. 后缀为 .html

这是在

现在,这两个路由将达到相同的控制器方法.

Now, both routes will reach the same controller method.

http://localhost:4413/abc/      -->  HomeController.Abc()
http://localhost:4413/abc.html  -->  HomeController.Abc() 

另请参阅: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆