我通常使用 URL 重写将内容 ID 传递到我的网站,因此这
Foo.1.aspx
重写为
Foo.aspx?id=1
对于特定应用程序,我需要将多个 ID 传递到单个页面,因此我重写了一些内容来接受这一点:
Foo.1,2,3,4,5.aspx
这在 Cassini(Visual Studio 的内置临时 Web 服务器)中运行良好,但当我在运行 IIS 的实时服务器上尝试它时,却显示“Internet Explorer 无法显示网页”。这是 IIS 的限制吗?我应该只使用破折号或下划线而不是逗号吗?
最佳答案
据我所知,URL 的文件名部分允许使用逗号,但在域*中是保留字符。
您使用的是哪个版本的 IE?我遇到过 IE5.5 在逗号上截断 URL 的奇怪报告( link here ,但在 IE7 中测试了带有逗号的 URL,似乎没问题,所以如果有 IE bug,似乎不会继续出现 - 可能是 IIS 问题吗?
我想知道页面错误是否是由于 mod_rewrite
规则失败所致 - 您能否发布匹配多个 id 的规则并将它们传递到您的 Foo.aspx
?有没有可能它只匹配 Foo.N,N
,并且因更多逗号而失败?
2.2. Reserved Characters
Many URI include components consisting of or delimited by, certain special characters. These characters are called "reserved", since their usage within the URI component is limited to their reserved purpose. If the data for a URI component would conflict with the reserved purpose, then the conflicting data must be escaped before forming the URI.
reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | ","
The "reserved" syntax class above refers to those characters that are allowed within a URI, but which may not be allowed within a particular component of the generic URI syntax
关于asp.net - 我可以在 URL 中使用逗号吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/198606/