简体   繁体   English

IIS 上托管应用程序的 URL 重写

[英]Url Rewrite for hosted application on IIS

I have developed asp.net mvc core 3.0 web application and deployed in windows server.我已经开发了 asp.net mvc core 3.0 web 应用程序并部署在 windows server 中。 I would like to hide controller name in url.我想在 url 中隐藏控制器名称。

Example :例子 :

orginal url : www.example.com/test/authenticate/login原始网址:www.example.com/test/authenticate/login

expected url : www.example.com/test/login预期网址:www.example.com/test/login

Im not sure about it by achieve it code or IIS.我不确定通过实现它的代码或 IIS。

startup.cs route code. startup.cs 路由代码。

app.UseEndpoints(endpoints =>
{
       endpoints.MapControllerRoute(
           name: "default",
           pattern: "{controller=Home}/{action=Index}/{id?}");

});

Use Attribute routing:使用属性路由:

[Route("/")]
public class AuthenticateController : ControllerBase
{
    [HttpGet("login")]
    public IActionResult Get()
    {
        return Ok("Ok");
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在MVC中,单击iis8.5托管应用程序的链接时URL不能正确显示 - In MVC url is not getting properly on clicking a link for the iis8.5 hosted application 在MVC 4承载的IIS中部署MVC 3应用程序 - Deploying MVC 3 application in MVC 4 hosted IIS URL重写IIS,重定向到登录页面 - URL Rewrite IIS, Redirect to login page IIS重写不适用于应用程序的根目录 - IIS Rewrite does not work for the root of an application Windows身份验证模式下在IIS上托管的MVC应用程序不起作用 - MVC application hosted ON IIS for windows authentication mode not working IIS 8.5 URL将非www重写为www不起作用 - IIS 8.5 URL Rewrite non-www to www not working 本地IIS 10(Windows 10)上托管的应用程序在其他系统上的Windows身份验证失败 - Application hosted on local IIS 10 (Windows 10) failing windows authentication on other system Asp .Net MVC应用程序托管在IIS中,需要从同一域中的其他计算机访问 - Asp .Net MVC application hosted in IIS and needed to be accessed from other machines in the same domain IIS 7.5 URL重写:从旧域到新域的重定向规则似乎不起作用 - IIS 7.5 URL Rewrite: Redirect Rule does not appear to work from old domain to new domain IIS 7.5上托管的带有路由参数的Web Api - Web Api hosted on IIS 7.5 with routing parameters
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM