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

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

问题描述

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

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

<ControllerName>/:id

使用IIS Express在localhost上运行,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在localhost上自动转换为小写,但在服务器上保持大写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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