i solved my problem by doing this
point of intrest i used blogenginenet and in sitemap i want to get the post which i update on my application blog
you can check go
www.learntus.com
where you see blog in menubar this is implement by blogenginenet
i do strongly hardwork to manuplates this thing
when i create a new post then it automatically add in sitemap.xml of my website
learntus.com/sitemap.xml
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Configuration;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
public partial class AdminPannel_SiteMap : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (File.Exists(Server.MapPath("~/sitemap.xml")))
{
File.Delete(Server.MapPath("~/sitemap.xml"));
}
Response.Clear();
Response.ContentType = "text/xml";
XmlDocument doc = new XmlDocument();
using (XmlTextWriter writer = new XmlTextWriter(Server.MapPath("~/sitemap.xml"), Encoding.UTF8))
{
writer.WriteStartDocument();
writer.WriteStartElement("urlset");
writer.WriteAttributeString("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9");
writer.Formatting = Formatting.Indented;
writer.Indentation = 4;
//==== Create links for static pages.
writer.WriteStartElement("url");
writer.WriteElementString("loc", "https://learntus.com/");
writer.WriteElementString("lastmod", "2020-01-18T07:45:27+00:00");
writer.WriteElementString("priority", "1.0");
writer.WriteEndElement();
writer.Formatting = Formatting.Indented;
writer.Indentation = 4;
writer.WriteStartElement("url");
writer.WriteElementString("loc", "https://learntus.com/Default.aspx");
writer.WriteElementString("lastmod", "2020-01-18T07:45:27+00:00");
writer.WriteElementString("priority", "1.0");
writer.WriteEndElement();
writer.Formatting = Formatting.Indented;
writer.Indentation = 4;
writer.WriteStartElement("url");
writer.WriteElementString("loc", "https://learntus.com/AllCourses");
writer.WriteElementString("lastmod", "2020-01-18T07:45:27+00:00");
writer.WriteElementString("priority", "0.50");
writer.WriteEndElement();
writer.Formatting = Formatting.Indented;
writer.Indentation = 4;
writer.WriteStartElement("url");
writer.WriteElementString("loc", "https://learntus.com/Contactus");
writer.WriteElementString("lastmod", "2020-01-18T07:45:27+00:00");
writer.WriteElementString("priority", "0.50");
writer.WriteEndElement();
writer.Formatting = Formatting.Indented;
writer.Indentation = 4;
writer.WriteStartElement("url");
writer.WriteElementString("loc", "https://learntus.com/Login");
writer.WriteElementString("lastmod", "2020-01-18T07:45:27+00:00");
writer.WriteElementString("priority", "0.50");
writer.WriteEndElement();
writer.Formatting = Formatting.Indented;
writer.Indentation = 4;
writer.WriteStartElement("url");
writer.WriteElementString("loc", "https://learntus.com/PrivacyPolicy");
writer.WriteElementString("lastmod", "2020-01-18T07:45:27+00:00");
writer.WriteElementString("priority", "0.50");
writer.WriteEndElement();
writer.Formatting = Formatting.Indented;
writer.Indentation = 4;
writer.WriteStartElement("url");
writer.WriteElementString("loc", "https://learntus.com/TearmAndConditions");
writer.WriteElementString("lastmod", "2020-01-18T07:45:27+00:00");
writer.WriteElementString("priority", "0.50");
writer.WriteEndElement();
writer.Formatting = Formatting.Indented;
writer.Indentation = 4;
writer.WriteStartElement("url");
writer.WriteElementString("loc", "https://learntus.com/register-as-a-learner");
writer.WriteElementString("lastmod", "2020-01-18T07:45:27+00:00");
writer.WriteElementString("priority", "0.50");
writer.WriteEndElement();
writer.Formatting = Formatting.Indented;
writer.Indentation = 4;
writer.WriteStartElement("url");
writer.WriteElementString("loc", "https://learntus.com/register-as-an-educator");
writer.WriteElementString("lastmod", "2020-01-18T07:45:27+00:00");
writer.WriteElementString("priority", "0.50");
writer.WriteEndElement();
writer.Formatting = Formatting.Indented;
writer.Indentation = 4;
//===== Get dynamic Links
using (SqlConnection conn = connectionblogengine.getConnection())
{
using (SqlCommand cmd = new SqlCommand("GetSiteMapContent", conn))
{
cmd.CommandType = CommandType.StoredProcedure;
conn.Open();
using (SqlDataReader rdr = cmd.ExecuteReader())
{
while (rdr.Read())
{
writer.WriteStartElement("url");
writer.WriteElementString("loc", "https://learntus.com/blog/post/" + string.Format("{0:yyyy/MM/dd}", rdr[1])+"/" + rdr["Slug"].ToString());
writer.WriteElementString("lastmod", string.Format("{0:yyyy/MM/dd}", rdr[1]));
writer.WriteElementString("priority", "0.64");
writer.WriteEndElement();
writer.Formatting = Formatting.Indented;
writer.Indentation = 4;
}
writer.WriteEndElement();
writer.WriteEndDocument();
doc.Save(writer);
writer.Flush();
}
Response.End();
}
}
}
}
}
create procedure GetSiteMapContent
as
select url,date from tbl_sitemap
go