%E2%80%8B 出现在 url .Net Core [英] %E2%80%8B Appears in url .Net Core

查看:41
本文介绍了%E2%80%8B 出现在 url .Net Core的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从未遇到过这样的问题,但它显示为路线的一部分,如果我手动输入路线,则结果为 404.

I never experienced such issue, but it appears as part of route and if I manually enter route then the result is 404.

If I copy from swagger %E2%80%8B 出现.

If I copy from swagger %E2%80%8B appears.

我该如何解决这个问题?

How can I fix this issue?

.Net 核心 2.1

.Net Core 2.1

http://localhost/functionCodes/%E2%80%8Btest - 有效

http://localhost/functionCodes/%E2%80%8Btest - works

http://localhost/functionCodes/test - 404

http://localhost/functionCodes/test - 404

推荐答案

根据:这张图表

%E2%80%8B 是零宽度空间"的代码.字符.

%E2%80%8B is the code for a "ZERO-WIDTH SPACE" character.

它可能在您不知何故的情况下被插入,您可能无法在代码中看到它,但它就在这里.

It has probably been inserted without you noticing it somehow, you probably can't see it in your code, but it is here.

我建议完全删除定义 URL 的字符串(包括周围的引号!)并重新编写它.

I recommend completely removing the string (including the surrounding quotes!) where the URL is defined and re-write it.

因为你用的是ASP.NET,这个路径可能来自一个Controller中的一个Action方法的名字,但是解决方法是一样的:完全去掉Test()方法的名字,确保在此之前删除一些空格字符,然后重新编写.

Since you use ASP.NET, this path may come from the name of an Action method in a Controller, but the solution is the same: remove completely the name of the Test() method, making sure you delete some space characters before that, and rewrite-it.

如果你想检查这个,你可以使用一些高级文本编辑器或十六进制编辑器来查看它实际上是在源代码中.

If you want to inspect this, you can probably use some advanced text editor or hexadecimal editor to view that it is actually in the source code.

可能有一些 Visual Studio 扩展也可以帮助您查看这些隐藏字符.

There may be some Visual Studio extensions that would help you view these hidden characters as well.

这篇关于%E2%80%8B 出现在 url .Net Core的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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