dotnetspider.com


 


TutorialsForumResourcesReviewsJobsInterviewVideosCommunitiesProjectsTraining

Subscribe to Subscribers


Online MembersSankar
Sunitha
Ashokkumar
Anu George
chanti
Falguni
Prachi Kulkarni
cloud
Prasad kulkarni
Gokula
Prabu Thangavelu
More...




Resources » Articles » ASP.NET/Web Applications


Changing SiteMap File name


Posted Date:     Category: ASP.NET/Web Applications    Rating: 1 out of 5
Author: Member Level: Silver    Points: 11


Changing SiteMap File name


The navigation system introduced in ASP.NET 2.0 allows developers to store the entire website structure in an XML file called sitemap. By default the site navigation system works with the sitemap file named Web.sitemap. What if you want to change the file name to something else say Site.sitemap?
This article will describe how to make your navigation system work with a sitemap file named other than Web.sitemap. If you change your sitemap file name, you will get the following exception:
System.InvalidOperationException: The file web.sitemap required by XmlSiteMapProvider does not exist.

Open your web application root web.config file and add the following code to your web.config in <system.web> element

<siteMap defaultProvider="CustomXmlSiteMapProvider" >

<providers>
<add siteMapFile="Site.sitemap" name="CustomXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>

</siteMap>


The above code registers a XMLSiteMapProvider named CustomXMLSiteMapProvider. You can choose any name for provider you want. siteMapFile attribute specifies the name of the file that provider will use to load navigation data. You will set this attribute’s value to the name of your Sitemap file. In the above mentioned code I have set it to site.sitemap which means I can use the sitemap file named Site.sitemap.


defaultProvider attribute of the siteMap element is essential because it sets the default sitemap provider for application. If this attribute is not included the application will continue using the default AspNetXMLSiteMapProvider which is registered in the Framework’s web.config and uses the Web.sitemap file.

Hope this helps
Mohsin


Did you like this resource? Share it with your friends and show your love!





Responses to "Changing SiteMap File name"

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: Handling concurrent AJAX requests
    Previous Resource: ASP.Net Basic Questions
    Return to Resources
    Post New Resource
    Category: ASP.NET/Web Applications


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Site Navigation in ASP.NET  .  SiteMap in ASP.NET  .  

    My Profile

    Active Members
    TodayLast 7 Daysmore...


    Awards & Gifts


    Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds



    About Us    Trademark Disclaimer    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.