<?xml version="1.0"?>
<configuration>
  <appSettings/>
  <connectionStrings/>
  <system.web>
    <urlMappings enabled="true">
      <add url="~/dd.aspx" mappedUrl="~/Default.aspx?id=11" />     
    </urlMappings>
    <compilation debug="true"/>
    <authentication mode="Windows"/>
  </system.web>
</configuration>其实.NET 2.0 上面这个功能可以实现改写功能了
我想问的是如何动态给这里添加一些值
如我有表tab
id  url
1   AA
2   BB
3   CC
当输入aa.aspx 转到 default.aspx?id=1
当输入bb.aspx 转到 default.aspx?id=2
当输入cc.aspx 转到 default.aspx?id=3
这些我不写到web.config
当知道运行的时候由程序写进去
要怎么做

解决方案 »

  1.   

    System.Configuration.Configuration config =
                    ConfigurationManager.OpenExeConfiguration(
                    ConfigurationUserLevel.None);
            config.Sections.Remove("name");
            config.Sections.Add("name");
            customSection.SectionInformation.ForceSave = true;
            config.Save(ConfigurationSaveMode.Full);
      

  2.   

    .net 2.0完全不用任何配置即可,在global.asax里可以直接转向
    protected void Application_BeginRequest(Object sender, EventArgs e)
      {
       //读取数据库,或者自己写个xml
       //判断地址,转陈新地址
       HttpContext.Current.RewritePath(newUrl);  }