我可以把一个+号与IIS的文件夹中? [英] Can I put a + sign in a folder with IIS?
问题描述
我是pretty肯定不能这样做,但我正在寻找一个黑客或办法把A +文件夹名称,如
I'm pretty sure this can't be done, but I'm looking for a hack or way to put a + in a folder name, like
http://www.mysite.com/cats+dogs/Default.aspx
我使用的是IIS 7,并试图创建一个虚拟目录,以实现这一目标,并没有奏效。我不允许把%2B在浏览器文件夹或虚拟文件夹的名称。
I'm using IIS 7, and have tried creating a virtual directory to achieve this, and it didn't work. I am not allowed to put %2B in the explorer folder or virtual folder name.
任何想法我怎么能破解这使它工作?我们已经有小册子印上去的,上面有一个网址,并想知道是否有一些方法可以让我别名,或一些技巧,可能会做到这一点。
Any ideas how I could hack this to make it work? We've already had brochures printed up with a url on it, and wondering if there is some way I can alias it or some trick that might do it.
编辑:我能想出解决办法,通过与它+创建虚拟文件夹,然后重定向到一个URL,它指向与内容的虚拟目录。
I was able to figure this out, by creating a virtual folder with a + in it, then redirecting to a URL, which points to a virtual directory with the content.
推荐答案
您可能有一些运气做一个url重写。这可以在web.config或与HTTP模块很容易地完成。
You may have some luck with doing a url-rewrite. This can be done very easily in the web.config or with an httpmodule.
看起来你仍然需要使用空间或IIS修正以下提到的+字符的问题,但在未来一定的灵活性,你总是可以包含URL映射到文件URL重写。
Looks like you will still need to use a space or the IIS fix mentioned below for your + character issue, but for some flexibility in the future you can always include URL rewrites for mapping urls to files.
<httpModules>
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpModules>
<rewriter>
<rewrite url="~/cats dogs/Default.aspx" to="~/MyRealFile.aspx" />
</rewriter>
这篇关于我可以把一个+号与IIS的文件夹中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!