TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Hazel Mahmud
1.4k
315
70k
add fake query string to duplicate sitemap URL
Feb 23 2016 10:25 PM
hello..i have created dynamic sitemap using XMLTextWriter. i have succeeded to retrieve from database but unfortunately there are some duplicate URL which sitemap did not allow. how do i add fake querystring to the duplicate URL so that it works well..please help..below are my aspx.cs code..
using (XmlTextWriter writer = new XmlTextWriter(Server.MapPath("web.sitemap"), Encoding.UTF8))
{
writer.WriteStartDocument();
writer.WriteRaw("\n");
writer.WriteStartElement("siteMap");
writer.WriteAttributeString("xmlns", "http://schemas.microsoft.com/AspNet/SiteMap-File-1.0");
writer.WriteRaw("\n");
writer.WriteRaw("\t");
writer.WriteStartElement("siteMapNode");
writer.WriteAttributeString("url", "~/index.aspx");
writer.WriteAttributeString("title", "Home");
writer.WriteRaw("\n");
writer.WriteRaw("\t\t");
writer.WriteStartElement("siteMapNode");
writer.WriteAttributeString("url", "~/MainPage/MyProfile.aspx?Value=" + lblsystemID.Text);
writer.WriteAttributeString("title", "Self-Service");
using (SqlConnection con = ClassConn.GetPortalCon())
{
SqlCommand cmd = new SqlCommand("ret_Menu", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@userID", nopkj);
cmd.Parameters.AddWithValue("@systemID", lblsystemID.Text);
SqlDataReader sc = cmd.ExecuteReader();
if (sc.HasRows)
{
while (sc.Read())
{
var menuID = sc["menuID"].ToString();
writer.WriteRaw("\n"); writer.WriteRaw("\t\t\t");
writer.WriteStartElement("siteMapNode");
writer.WriteAttributeString("url", sc["menuPath"].ToString());
writer.WriteAttributeString("title", sc["menu_label"].ToString());
writer.WriteAttributeString("description", sc["menu_label"].ToString());
using (SqlConnection con1 = ClassConn.GetPortalCon())
{
SqlCommand cmd1 = new SqlCommand("ret_SubMenuSiteMap", con1);
cmd1.CommandType = CommandType.StoredProcedure;
cmd1.Parameters.AddWithValue("@userID", nopkj);
cmd1.Parameters.AddWithValue("@systemID", lblsystemID.Text);
cmd1.Parameters.AddWithValue("@menuID", menuID);
SqlDataReader sc1 = cmd1.ExecuteReader();
if (sc1.HasRows)
{
while (sc1.Read())
{
writer.WriteRaw("\n");
writer.WriteRaw("\t\t\t\t");
writer.WriteStartElement("siteMapNode");
writer.WriteAttributeString("url", sc1["subMenuPath"].ToString());
writer.WriteAttributeString("title", sc1["submenu_label"].ToString());
writer.WriteAttributeString("description", sc1["submenu_label"].ToString());
writer.WriteEndElement();
}
}
}writer.WriteEndElement();
}
}
}
writer.WriteEndElement();
writer.WriteEndDocument();
}
Reply
Answers (
1
)
what database is not need installation c# ?
Linq