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.


  • 相关阅读:
    vbox虚拟机网络设置
    增删改查
    事务
    jsp&el&jstl mvc和三层架构
    cookie&session
    request
    Response
    eclipse操作(备忘)
    Servlet
    Http&Tomcat
  • 原文地址:https://www.cnblogs.com/rickie/p/601716.html
Copyright © 2011-2022 走看看