问题描述
我在路由方面有一个奇怪的问题。我有一个现有网站正在尝试添加到该网站。它有效,但前提是.aspx位于URL的末尾。如果删除.aspx,它会给我一个错误:找不到资源。我创建了一个快速测试网站,并将代码复制到该网站上,效果很好。两者之间的代码相同。两者都在VS 2008 Web服务器上运行。我就是不明白。有什么想法吗?
I have a weird problem with routing. I have an existing website that I am trying to add this to. It works, but only if .aspx is on the end of the URL. If I remove the .aspx, it gives me an error: "The resource cannot be found." I created a quick test website and copied the code over to it, it works just fine. The code between the 2 are identical. Both are running on the VS 2008 web server. I just don't get it. Any ideas?
谢谢,
Vincent
Thanks,Vincent
推荐答案
好的,我发现了问题。我不明白为什么这会导致问题,但是如果URL中的任何位置都有句点(。),则会出错。
Okay, I found the problem. I don't understand why this caused the problem, but if there is a period (.) anywhere in the URL, it errors.
我有这个:
当我将其更改为:,删除站点与开发者之间的时间,效果很好。
When I changed it to: http://localhost:49463/sitedev/products/keylessentrykits, removing the period between site and dev, it worked fine.
有人知道这是为什么吗?是一个错误吗?
Anyone have a clue to why this is? Is it a bug?
此外,我之前应该说过话,但这不是MVC应用程序。
Also, I should have said something before, but this is not an MVC app.
这篇关于除非最后输入.aspx,否则Asp.Net System.Web.Routing不会路由URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!