防止子目录成为 link 的一部分?
Prevent subdirectory from being a part of the link?
我目前正在重构我的网站,我注意到我的嵌套结构显示为我正在浏览 File Explorer
。我在网上找不到任何关于防止以这种方式显示的信息。
我想确保我的项目井井有条,这导致页面有时深达 5 层(基本示例):
mywebsitedotcom/gaming/2d/arcade/pong.aspx
我希望它看起来像:
mywebsitedotcom/gaming/pong.aspx
如何确保网址不显示我的组织结构的一部分?
您可以使用名为 UrlMapping 的东西。
它是您 web.config 中的一个元素,它类似于:
<system.web>
<urlMappings enabled="true">
<add url="~/gaming/2d/arcade/pong.aspx"
mappedUrl="~/gaming/pong.aspx"/>
<add url="~/anotherurl/another.aspx"
mappedUrl="~/otherurl/otherpage.aspx"/>
</urlMappings>
我目前正在重构我的网站,我注意到我的嵌套结构显示为我正在浏览 File Explorer
。我在网上找不到任何关于防止以这种方式显示的信息。
我想确保我的项目井井有条,这导致页面有时深达 5 层(基本示例):
mywebsitedotcom/gaming/2d/arcade/pong.aspx
我希望它看起来像:
mywebsitedotcom/gaming/pong.aspx
如何确保网址不显示我的组织结构的一部分?
您可以使用名为 UrlMapping 的东西。
它是您 web.config 中的一个元素,它类似于:
<system.web>
<urlMappings enabled="true">
<add url="~/gaming/2d/arcade/pong.aspx"
mappedUrl="~/gaming/pong.aspx"/>
<add url="~/anotherurl/another.aspx"
mappedUrl="~/otherurl/otherpage.aspx"/>
</urlMappings>