.net - 允许在 URL 中使用星号

标签 .net asp.net asp.net-mvc-2 .net-4.0

我在我的网站 URL 中允许使用星号 (*) 时遇到问题。我正在运行 ASP.NET MVC 2 和 .NET 4.0。

这是描述问题的示例:

http://mysite.com/profile/view/Nice *

用户名是 Nice* 并且 ASP.NET 说 URL 中有非法字符:

Illegal characters in path.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: Illegal characters in path.

我已经尝试了我在网上看到的所有 Web.config 方法,例如:
<pages validateRequest="false">


<httpRuntime requestPathInvalidCharacters="" requestValidationMode="2.0" />

所以我的问题是:是否可以在 URL 中允许星号?如果没有,.NET 中是否有一些编码方法可以编码 asterisk(*) ?

谢谢!

最佳答案

http://www.w3.org/Addressing/URL/4_URI_Recommentations.html

Other reserved characters

The asterisk ("*", ASCII 2A hex) and exclamation mark ("!" , ASCII 21 hex) are reserved for use as having special signifiance within specific schemes.

关于.net - 允许在 URL 中使用星号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4567215/

相关文章:

c# - asp.net mvc发布请求+服务层-最好的方法

c# - asp.net - linq to sql 简单问题

c# - 在 EventHandler 中对发送者对象进行单元测试

.net - .Net 1.1 中的 XSL 到 HTML : How to include javascript which has '&&' without getting errors?

c# - 如何仅在最小字符后检查密码强度?

ASP.net C# - WINWORD.exe

c# - ASP.Net 中的客户端应用程序

c# - 如何使用 string.contains 查找分隔/隔离的子字符串?

asp.net - IIS Express 错误 500.19 (0x80070003) 无法读取配置文件

entity-framework - Code First 添加到集合中?如何在存储库中使用 Code First?