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.


  • 相关阅读:
    1036 商务旅行
    4165 ​高精度求阶乘
    3117 高精度练习之乘法
    封装代理
    freemarker写select组件(三)
    VC双缓冲画图技术介绍
    JS学习十七天----工厂方法模式
    Struts2 全局结果集
    HDU 1730 Northcott Game
    C++ STL:vector
  • 原文地址:https://www.cnblogs.com/rickie/p/601716.html
Copyright © 2011-2022 走看看