.net 站点地图 不胜感谢 很加分! 对这个用的不多 好像 只能到xml中配置吧 ,不管怎么导向 最终显示是根据xml中配置的层级关系来的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在*.siteMap中配置,用url传个数值。 通过XML可配置。参考http://www.cnblogs.com/webabcd/archive/2008/10/31/650773.htmlhttp://www.cnblogs.com/Moosdau/archive/2007/09/28/908757.html 用操作xml的方法修改<siteMapNode url="showp.aspx" title="景点">属性值。但是我也不会。呵呵。如果嫌麻烦,你可以不用sitemap没有sitemap之前,不是一样做站点地图吗?用一般的方法也行。 参考下 http://hi.baidu.com/zdz8207/blog/item/c4b2de5453df4a5bd0090642.html, 看看是不是你要的东西 public partial class CreateSitemap : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { using (StreamWriter sw = new StreamWriter(Server.MapPath("Sitemap.xml"), false, Encoding.UTF8)) { sw.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); sw.WriteLine("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\" http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/09/sitemap.xsd\">"); //HTML URL using (StreamReader sr = new StreamReader(Server.MapPath("HTMLURL.txt"), Encoding.UTF8)) { string line = String.Empty; while ((line = sr.ReadLine()) != null) { sw.WriteLine(URL(line)); } } //Product URL DataAccess data = new DataAccess(); using (SqlDataReader dr = data.GetDataReader("SELECT a.dw_products_id, a.Title+'_'+b.Title as CategoryTitle,a.manual_link FROM dw_products a,sub_categories b where a.sub_categories_id=b.sub_categories_id Order by dw_products_id desc")) { while (dr.Read()) { sw.WriteLine(URL8("http://www.xxx.com/update/" + Common.URLStringDeal(dr[1]) + "_Product.aspx?id=" + dr[0].ToString())); if(!String.IsNullOrEmpty(dr[2].ToString())) sw.WriteLine(URL("http://www.xxx.com/Lift_Manuals/" + dr[2].ToString().Replace(" ", "_").Replace("&", ""))); } } //PDF Link URL using (SqlDataReader dr = data.GetDataReader("SELECT * FROM dw_products_articles")) { while (dr.Read()) { if(!String.IsNullOrEmpty(dr[4].ToString())) sw.WriteLine(URL("http://www.xxx.com/hotbike/" + dr[4].ToString())); } } sw.WriteLine("</urlset>"); sw.Flush(); } File.Copy(Server.MapPath("Sitemap.xml"), Server.MapPath("update/Sitemap.xml"), true); File.Copy(Server.MapPath("Sitemap.xml"), Server.MapPath("html/Sitemap.xml"), true); File.Copy(Server.MapPath("Sitemap.xml"), Server.MapPath("urllist.txt"), true); File.Copy(Server.MapPath("Sitemap.xml"), Server.MapPath("update/urllist.txt"), true); File.Copy(Server.MapPath("Sitemap.xml"), Server.MapPath("html/urllist.txt"), true); } private string URL(string url) { string priority = "0.5"; string lastmod = DateTime.Now.ToString("yyyy-MM-ddThh:mm:ss-06:00"); string changefreq = "weekly"; string temp = ""; temp += "<url>\n"; temp += "<loc>" + url + "</loc>\n"; temp += "<priority>" + priority + "</priority>\n"; temp += "<lastmod>" + lastmod + "</lastmod>\n"; temp += "<changefreq>" + changefreq + "</changefreq>\n"; temp += "</url>\n"; return temp; } private string URL8(string url) { string priority = "0.8"; string lastmod = DateTime.Now.ToString("yyyy-MM-ddThh:mm:ss-06:00"); string changefreq = "weekly"; string temp = ""; temp += "<url>\n"; temp += "<loc>" + url + "</loc>\n"; temp += "<priority>" + priority + "</priority>\n"; temp += "<lastmod>" + lastmod + "</lastmod>\n"; temp += "<changefreq>" + changefreq + "</changefreq>\n"; temp += "</url>\n"; return temp; }} 以前做过的一个例子也是通过XML来实现的 【提问】难题,多线程处理到底该咋用,大家进来看看 如何在asp.net中读取asp cookies值 ASP基础学习ASP.NET,请荐书 关于执行一个字符串的问题 $.post发布到服务器后本地运行无效? customvalidator 何时触发 GridView1.Columns.count 怎么会为0 源文件中好多乱码(郁闷) 微软中国社区树形编程例子的一个问题. 求助:asp.net服务器端处理Excel文件时服务器出现意外错误 求可动态改变DataGrid列宽的CSS 如何获得隐藏层的text的值
参考
http://www.cnblogs.com/webabcd/archive/2008/10/31/650773.html
http://www.cnblogs.com/Moosdau/archive/2007/09/28/908757.html
但是我也不会。呵呵。如果嫌麻烦,你可以不用sitemap
没有sitemap之前,不是一样做站点地图吗?
用一般的方法也行。
public partial class CreateSitemap : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
using (StreamWriter sw = new StreamWriter(Server.MapPath("Sitemap.xml"), false, Encoding.UTF8))
{
sw.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
sw.WriteLine("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\" http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/09/sitemap.xsd\">"); //HTML URL
using (StreamReader sr = new StreamReader(Server.MapPath("HTMLURL.txt"), Encoding.UTF8))
{
string line = String.Empty;
while ((line = sr.ReadLine()) != null)
{
sw.WriteLine(URL(line));
}
} //Product URL
DataAccess data = new DataAccess();
using (SqlDataReader dr = data.GetDataReader("SELECT a.dw_products_id, a.Title+'_'+b.Title as CategoryTitle,a.manual_link FROM dw_products a,sub_categories b where a.sub_categories_id=b.sub_categories_id Order by dw_products_id desc"))
{
while (dr.Read())
{
sw.WriteLine(URL8("http://www.xxx.com/update/" + Common.URLStringDeal(dr[1]) + "_Product.aspx?id=" + dr[0].ToString()));
if(!String.IsNullOrEmpty(dr[2].ToString()))
sw.WriteLine(URL("http://www.xxx.com/Lift_Manuals/" + dr[2].ToString().Replace(" ", "_").Replace("&", "")));
}
} //PDF Link URL
using (SqlDataReader dr = data.GetDataReader("SELECT * FROM dw_products_articles"))
{
while (dr.Read())
{
if(!String.IsNullOrEmpty(dr[4].ToString()))
sw.WriteLine(URL("http://www.xxx.com/hotbike/" + dr[4].ToString()));
}
} sw.WriteLine("</urlset>");
sw.Flush();
}
File.Copy(Server.MapPath("Sitemap.xml"), Server.MapPath("update/Sitemap.xml"), true);
File.Copy(Server.MapPath("Sitemap.xml"), Server.MapPath("html/Sitemap.xml"), true); File.Copy(Server.MapPath("Sitemap.xml"), Server.MapPath("urllist.txt"), true);
File.Copy(Server.MapPath("Sitemap.xml"), Server.MapPath("update/urllist.txt"), true);
File.Copy(Server.MapPath("Sitemap.xml"), Server.MapPath("html/urllist.txt"), true);
} private string URL(string url)
{
string priority = "0.5";
string lastmod = DateTime.Now.ToString("yyyy-MM-ddThh:mm:ss-06:00");
string changefreq = "weekly"; string temp = "";
temp += "<url>\n";
temp += "<loc>" + url + "</loc>\n";
temp += "<priority>" + priority + "</priority>\n";
temp += "<lastmod>" + lastmod + "</lastmod>\n";
temp += "<changefreq>" + changefreq + "</changefreq>\n";
temp += "</url>\n"; return temp;
} private string URL8(string url)
{
string priority = "0.8";
string lastmod = DateTime.Now.ToString("yyyy-MM-ddThh:mm:ss-06:00");
string changefreq = "weekly"; string temp = "";
temp += "<url>\n";
temp += "<loc>" + url + "</loc>\n";
temp += "<priority>" + priority + "</priority>\n";
temp += "<lastmod>" + lastmod + "</lastmod>\n";
temp += "<changefreq>" + changefreq + "</changefreq>\n";
temp += "</url>\n"; return temp;
}
}