Angular 2 Route Param 在本地主机上自动转换为小写,但在服务器上保持大写 [英] Angular 2 Route Param automatically converting to lowercase on localhost but remains capitalized on server

查看:15
本文介绍了Angular 2 Route Param 在本地主机上自动转换为小写,但在服务器上保持大写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个 .NET angular 2 程序,其路由样式为

I currently have a .NET angular 2 program, with a route styled as

<ControllerName>/:id

使用 IIS Express 在本地主机上运行,​​id 路由参数在 URL 中自动转换为小写,无需我明确进行任何额外的格式化.调用同一个控制器,用矩阵记法输入ID,却失去了自动变成小写的能力

Run on localhost with IIS Express, the id route param automatically converts to lowercase in the URL without me expressly doing any extra formatting. When calling the same controller and using matrix notation to input ID, however, it loses it's ability to automatically become lowercase

<ControllerName>;id=<CAPSGUID>

奇怪的是,当我在 IIS 服务器上托管它时,这个功能不知何故丢失了,并且 id 路由参数仍然是大写的.有没有人对为什么会发生这种情况有任何经验?我一直在努力正确地表达问题以获取任何相关信息.

Curious thing is, when I host this on an IIS server, this functionality is somehow lost and the id route param remains upper case either way. Does anyone have any experience as to why this might happen? I've been having a hard time trying to properly word the question to get any related information.

推荐答案

我无法找出发生这种情况的原因,在我的测试过程中,该功能消失了.我最终使用了一个实现 DefaultUrlSerializer 的自定义 url 序列化程序,并添加了自动小写我的 GUID 组件的条件.希望这对某人有所帮助.

I couldn't find out the reason this was happening, and through the course of my testing the functionality disappeared. I ended up using a custom url serializer implementing DefaultUrlSerializer and adding conditions in which to automatically lowercase my GUID component. Hope this helps somebody.

这篇关于Angular 2 Route Param 在本地主机上自动转换为小写,但在服务器上保持大写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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