利用URL重写隐藏复杂的URL

第一步:模拟映射页面

我们想在一个页面上点击guid.html链接,跳转到比较复杂URL的guid_{492f3e0b-848e-11da-9550-00e08161165f}.html页面。即定义一个映射,该映射隐藏实际的URL并将其映射到用户更容易记忆的URL。

第二步:如何做到呢

来个非常简单的,在web.config文件的system.web节点设置urlMappings。

<system.web>
    <urlMappings enabled="True">
        <add url="~/guid.html" mappedUrl="guid_{492f3e0b-848e-11da-9550-00e08161165f}.html"/>
    </urlMappings>
</system.web>
//这时,点击guid.html链接,地址栏是guid.html,实际上是guid_{492f3e0b-848e-11da-9550-00e08161165f}.html页面的内容了。

  

posted @ 2016-01-23 11:22  Akgu  阅读(456)  评论(0编辑  收藏  举报