zoukankan      html  css  js  c++  java
  • URL mapping – ASP.NET 2.0 New feature

    URL mapping – ASP.NET 2.0 New feature

     

    Defines a mapping that hides the real URL and maps it to a more user-friendly URL.

    ……

         <system.web>

             <urlMappings enabled="true">

                  <add url="~/computerparts.aspx" mappedUrl="~/products/index.aspx?cid=01" />

                  <add url="~/digitalcamera.aspx" mappedUrl="~/products/index.aspx?cid=02" />

                  <add url="~/electronics.aspx" mappedUrl="~/products/index.aspx?cid=03" />

                  <add url="~/laptop.aspx" mappedUrl="~/products/index.aspx?cid=04" />

                  <add url="~/games.aspx" mappedUrl="~/products/index.aspx?cid=05" />

             </urlMappings>

         </system.web>

    用户看到的是url,而mappedUrl特性描述了实际请求的页面。

    ***

    You can add items to the urlMappings collection using the configuration API:

    Code snippet:


    Configuration config =

           WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);

    UrlMappingsSection section =

           (UrlMappingsSection)config.GetSection("system.web/urlMappings");

    section.UrlMappings.Add(new UrlMapping("~/video.aspx", "~/products/index.aspx?cid=08"));

    config.Save();

     

    You can iterate through your query, adding items to the collection.


  • 相关阅读:
    剑指offer十二之数值的整数次方
    剑指offer十一之二进制中1的个数
    剑指offer十之矩形覆盖
    剑指offer九之变态跳台阶
    剑指offer八之跳台阶
    程序员的生活观
    程序员,如何远离你的电脑
    生活管理实用技能
    分享共筑 : 伟大的理念
    技术人员,要学会关心别人
  • 原文地址:https://www.cnblogs.com/rickie/p/601716.html
Copyright © 2011-2022 走看看