XmlDocument doc = new XmlDocument();
doc.Load(“C:\\Users\\mx\\Desktop\\cmr\\DTcms_40_acc_src2\\DTcms.Web\\xmlconfig\\urls.config");
XmlNode xn = doc.SelectSingleNode("urls");
foreach (XmlElement xe in xn.ChildNodes)
{
if (xe.NodeType != XmlNodeType.Comment && xe.Name.ToLower() == "rewrite")
{
if (xe.Attributes["name"] != null)
{
if (!string.IsNullOrEmpty(channel))
{
if (xe.Attributes["channel"] != null && channel.ToLower() == xe.Attributes["channel"].Value.ToLower())
{
Model.url_rewrite model = new Model.url_rewrite();
if (xe.Attributes["name"] != null)
model.name = xe.Attributes["name"].Value;
foreach (XmlElement xe1 in xe.ChildNodes)
{
if (xe1.NodeType != XmlNodeType.Comment && xe1.Name.ToLower() == "item")
{
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<urls>
<rewrite name="index" type="index" page="index.aspx" inherit="DTcms.Web.UI.Page.index" templet="index.html">
<item path="index.aspx" pattern="index.aspx" />
</rewrite>
<rewrite name="search" type="other" page="search.aspx" inherit="DTcms.Web.UI.Page.search" templet="search.html" />
<rewrite name="usercenter" type="other" page="usercenter.aspx" inherit="DTcms.Web.UI.Page.usercenter" templet="usercenter.html">
<item path="user/center/{0}.aspx" pattern="user/center/(\w+).aspx" querystring="action=$1" />
</rewrite>
</urls>