How to Programmatically modify generate Sitemap in ASP.Net C#

3.7k views Asked by At

I am working on a multilingual Dynamic Website, I need to generate sitemap (Breadcrumb) navigation for each pages and i have done my research & worked of few example for last two days unfortunately i am not able programmatically generate site navigation based on site url.

Sample examples of my different URL

Example URL 1: Default.aspx?PageId=3&Language=en-US (Default.aspx is the home page) 
Example URL 2: Page.aspx?PageId=4&Language=ar-AE 
Example URL 3: Articles.aspx?PageId=6&Language=en-US 
Example URL 4: Articles.aspx?PageId=6&ArticleID=101&ArticleCatID=7&Language=en-US 
Example URL 5: Articles.aspx?PageId=6&ArticleID=101&ArticleCatID=7&ArticleTitle=How to generate Sitemaps&Language=en-US

Breadcrumb for above URL's Should be as : 

URL 1: Home
URL 2: Home > Profile
URL 3: Home > Article 
URL 4: Home > Article > ASP.Net
URL 5: Home > Article > ASP.Net > How to Generate Sitemaps

My Sitemap

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode url="Default.aspx" title="Home"  description="">
        <siteMapNode url="Page.aspx" title="Profile"  description="" />
        <siteMapNode url="Articles.aspx" title="Archive"  description="" />
        <siteMapNode url="PhotoGallery.aspx" title="Photo Gallery"  description="" />
        <siteMapNode url="Contact.aspx" title="Contact"  description="" />
    </siteMapNode>
</siteMap>

I have found an example which seems to be close enough but i cant make it works as i am net to C# programming & found it difficult.

http://msdn.microsoft.com/en-us/library/ms178425.aspx

I am only left with one choice to get the value against each querystring from the database and generate custom BreadCrumb Navigation which is going to be a bit of task and last option, This also has an advantage that i can get multilingual values against each querystring.

On the other side i am also keep to learn how to do it as shown in the example on MSDN site. In this example i was also confused how to handle multilingual part.

I would appreciate if someone can help me to get it write for me I would appreciate a complete example as i am new to C# & find it difficult without proper guidance.

1

There are 1 answers

0
Syed Umar Ahmed On