使用url重写组件Intelligencia.UrlRewriter.dll的问题!传多个参数???
使用url重写组件Intelligencia.UrlRewriter.dll的问题!传多个参数???说明:我有3个页面一个从Default.aspx 传一个参数链接到NewsList.aspx 页面列出新闻列表, 然后在传一个参数到ShowNews.aspx 页面列出新闻内容!
现在是我想从一个页面到另外一个页面传2个参数 里面的匹配规则该怎么写??
高人指点
高人指点
高人指点
高人指点
--------
web.config
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
</configSections>
<connectionStrings>
<add name="HTMLConnectionString" connectionString="Data Source=.;Initial Catalog=HTML;Persist Security Info=True;User ID=sa;Password=sa;Pooling=False"
providerName="System.Data.SqlClient" />
<add name="CMSB_CMSConnectionString" connectionString="Data Source=WWW-SERVER;Initial Catalog=CMSB_CMS;Persist Security Info=True;User ID=sa;Password=goodboy"
providerName="System.Data.SqlClient" />
<add name="CMS" connectionString="data source=192.168.1.201;uid=sa;pwd=goodboy;database=CMSB_CMS" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<httpModules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>
</httpModules>
<compilation debug="true" defaultLanguage="c#"/>
</system.web>
<rewriter>
<rewrite url="~/products/(.+).aspx" to="~/products.aspx?category=$1" />
<rewrite url="~/News/(.+).html" to="~/ShowNews.aspx?NewsId=$1"/>
<rewrite url="~/News/(.+).aspx" to="~/NewsList.aspx?NewsTypeId=$1"/>
</rewriter>
</configuration>
Default.aspx cs
--------------------------------
private void BindList()
{
DataSet ds = SqlHelper.GetDataSet("SELECT [NewsTypeId], [NewsTypeName] FROM [NewsType]", "CMSB_CMSConnectionString", "ty");
GridView1.DataSource = ds;
GridView1.DataBind();
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i <= ds.Tables[0].Rows.Count-1; i++)
{
HyperLink hl = (HyperLink)GridView1.Rows[i].FindControl("HyperLink1");
hl.Text = ds.Tables[0].Rows[i]["NewsTypeName"].ToString();
hl.NavigateUrl = "~/News/" + ds.Tables[0].Rows[i]["NewsTypeId"].ToString()+".aspx";
hl.Target = "_blank";
}
}
}
NewsList.aspx
------------------------------------
private void BindList()
{
DataSet ds = SqlHelper.GetDataSet("SELECT [NewsId], [Title] FROM [News] where TypeId=" + NewsTypeId + "", "CMSB_CMSConnectionString", "news");
GridView1.DataSource = ds;
GridView1.DataBind();
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i <= ds.Tables[0].Rows.Count-1; i++)
{
HyperLink hl = (HyperLink)GridView1.Rows[i].FindControl("HyperLink1");
hl.Text = ds.Tables[0].Rows[i]["Title"].ToString();
hl.NavigateUrl = "~/" + ds.Tables[0].Rows[i]["NewsId"].ToString() + ".html";
hl.Target = "_blank";
}
}
}
ShowNews.aspx cs
------------------------------------------
--------------------编程问答-------------------- 靠 连个人都没有
private void BindList()
{
DataSet ds = SqlHelper.GetDataSet("SELECT [NewsId], [Title],Content FROM [News] where NewsId=" + NewsId + "", "CMSB_CMSConnectionString", "news");
if (ds.Tables[0].Rows.Count > 0)
{
lab_title.Text = ds.Tables[0].Rows[0]["Title"].ToString();
lab_Content.Text = ds.Tables[0].Rows[0]["Content"].ToString();
}
}
--------------------编程问答-------------------- 蛋分帖,特别是不喜欢结贴的人,一般很多人都不喜欢替他解答。没诚意~~~
传递多个参数,你就按正则表达的个数,后缀分别用 $1 $2 ......依次表达就可以了 --------------------编程问答-------------------- 使用“&”来代替“&”,这是XML文档语法的需要 --------------------编程问答-------------------- 如果您有一技之长,请到淘师宝发帖子收徒弟;
如果您想学习一门技能,请到淘师宝发帖子拜师傅;
拜师傅,收徒弟,到淘师宝,网址:www.taoshibao.com --------------------编程问答-------------------- 很好,很好
补充:.NET技术 , ASP.NET