.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Sitemap in MVC

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :ASP.Net

I wants to list out all links in my project using sitemap pages in MVC.

How to display all links in a particular page to display using sitemap in MVC?


View Complete Post

More Related Resource Links

Custom Control Design-Time SiteMap Provider Error


Greetings - I was referred here by MSDN forums hope this is the right place -  

I have a custom control (:WebControl) that renders web.sitemap in a specific way. While it runs error free and produces the expected result, at Design-Time it complains

Error Creating Control - MyControl  The provider 'AspNetXmlSiteMapProvider' specified for the defaultProvider does not exist in the providers collection.

I have discovered that the error is cause by this line of code:

string div = string.Format("<div class='{0}' id='{1}'>{2}</div>", this.CssClass, this.ID.ToString(), EnumerateNodesRecursive(SiteMap.RootNode, level));

or more specifically, by the reference to SiteMap.RootNode - I am not clear what is missing thoough because I have configured the SiteMapProvider in web.config as this:

        <add name="AspNetXmlSiteMapProvider" 
             type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 

ImageURL SiteMap Node


Hi Can anyone tell me how i can add the ImageURL from a sitemap into a navigation menu, i had this working with webforms but cannot get it to work with mcv

var sbMenuHelper = new StringBuilder();

sbMenuHelper.Append("<ul class='cssMenu'>");

var topLevelNodes = SiteMap.RootNode.ChildNodes;
foreach (SiteMapNode node in topLevelNodes)
    if (SiteMap.CurrentNode == node)
        sbMenuHelper.AppendFormat("<a href='{0}'>{1}</a>", node.Url, helper.Encode(node.Title));

return sbMenuHelper.ToString();

        description="Contact Us"

Linq Save to ror.xml or other sitemap.xml


Hi there, 

I'm trying to make a script for a site, that updates the sitemaps in the background.

I didn't create this site, and someone before me added in the ror.xml and sitemap.xml and urllist.txt files.

I want to update these all at the same time. If the url is not in there already of course...

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:ror="http://rorweb.com/0.1/" >
  <title>ROR Sitemap for http://www.envirospec.co.nz/</title>

Trying to get to a page via an email link. Could the sitemap be stopping this?


I had this working.  I would email a link to a page (i.e. Work.aspx), and using the code below, the user would be routed to the login page and then sent  to Work.aspx after logging in.

But since I added a site map this isn't working.  I always go directly to my home page.  If I set Work.aspx as my start page in VS it works, but not if I click a link in the email.

Any thoughts?

 protected void Page_Load(object sender, EventArgs e)


        if (!Page.User.Identity.IsAuthenticated)

            Response.Redirect("~/Login.aspx" + "?ReturnUrl=~/Work.aspx");


    protected void Page_Load(object sender, EventArgs e)
        if (!Page.User.Identity.IsAuthenticated)

sitemap control user rights enable and disable



iam using masterpage and sitemap in my project, what i want to is that

if user login is did, based on the user previlage in need to show the sitemap menu page

if user i have the previlage to see the page then i should enable that page otherwise

i need disable that page

looking for the valuable suggestions

Sitemap issue

Hello, This question pertains to the web.sitemap and the sitemap control. I have the following entry in the web.sitemap:<siteMapNode url="Default.aspx" title="Home" description=""> <siteMapNode url="" title="Articles" description=""> <siteMapNode url="~/TBSArticles/ShowCategories.aspx" title="Categories" description="" /> <siteMapNode url="~/TBSArticles/ProductShowCase.aspx" title="Product Showcase" description="" /> <siteMapNode url="~/TBSArticles/ProductReview.aspx" title="Product Review" description="" /> </siteMapNode> </siteMapNode> </siteMap> The Home and Article texts show as separate tabs on the menu control. Under Article, "Categories", "Product Showcase" and  "Product Review" show as drop down menus. When I click on "Categories" the site map control shows "Home -> Article -> Categories", and the ShowCategories.aspx page is displayed on the browser . The ShowCategories.aspx page has several links. When any one is clicked it it leads to the BrowseArticles.aspx page with an unique querystring value. The problem is that at this stage, the sitemap becomes blank an

Create sitemap

I have to create a sitemap for my website in asp.net 2.0. Can anybody tell me the procedure for the same.I am totally new to this concept.. 

URL routing with a dynamic .sitemap file

Hi,I've implemented URL routing now I've upgraded to .NET 4 following http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx.The only problem I've encountered is with the .sitemap file. If I put, for example: <siteMapNode url="~/recipes/Starters" title="Browse Starters"> it renders correctly. However, I need to do something like this: <siteMapNode url="~/recipes/{category}" title="Browse {category}"> - i.e. dynamically giving a titleOr, I'd settle for something like this: <siteMapNode url="~/recipes/*" title="Browse Recipes"> - i.e. covering all recipe pages Has anyone found a nice solution to this?

localization sitemap on MasterPage

Hi Everyone, i am new in localization.I need to create a website in dual language.I plan to put the sitemap and change language dropdownlist in the master page.May anyone advice on how to i change the sitemap language at treeview and Menu on master page?

problem with sitemap schema 'xsi:schemaLocation' in XML file creation

SqlConnection conn = new SqlConnection(connStr); conn.Open(); string sql = "select top 10 catnum,cast(case when isnull(onhand,0) < 5 then 0 else round((onhand/2),1) end as int) as onhand from dbo.V_OnHand with (nolock)"; SqlCommand cmd = new SqlCommand(sql, conn); XmlDocument doc = new XmlDocument(); XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "UTF-8", null); XmlElement rootNode = doc.CreateElement("inventory"); doc.InsertBefore(dec, doc.DocumentElement); rootNode.SetAttribute("xmlns", "http://seller.marketplace.tests.com/inventory/v1"); rootNode.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); rootNode.SetAttribute("xsi:schemaLocation", "http://sellersupport.domain.test.com/test1/s/schema/inventory/inventory-xml-feed-v1.xsd"); doc.AppendChild(rootNode); XmlElement fbm = doc.CreateElement("inventory"); doc.DocumentElement.PrependChild(fbm); SqlDataReader rdr1 = cmd.ExecuteReader(); while (rdr1.Read()) { XmlElement item = doc.CreateElement("item"); item.Set

Creating image based site navigation using standard sitemap

I know how to create a normal menu and change them the way i want using css, but I dont know how to use images instead of text.I want to make it look cooler using images so in order to do that, I haven't got any ideas at all :(I have seen many websites on internet like this and I dont think its a difficult thing to do for some of you here.Could you please guide me or show me the way forward ? Thanks. 

Sitemap refresh

Hi,I am learning ASP and i have one problem.I've menu which is created from Sitemap. Look here: 1. public class SqlSiteMapProvider : StaticSiteMapProvider 2. { 3. 4. private SiteMapNode myRootNode; 5. private BlogEntities myEntities; 6. 7. public SqlSiteMapProvider() 8. { 9. myRootNode = null; 10. } 11. 12. public override SiteMapNode BuildSiteMap() 13. { 14. using (myEntities = new BlogEntities()) 15. { 16. lock (this) 17. { 18. if (myRootNode == null) 19. { 20. myRootNode = new SiteMapNode(this, Guid.NewGuid().ToString(), this.Url, this.Title); 21. foreach (Category aCategory in myEntities.Categories) 22. { 23. SiteMapNode aNode = new SiteMapNode(this, Guid.NewGuid().ToString(), string.Format(this.UrlFormatString, aCategory.CategoryID.ToString()), aCategory.Title.ToString()); 24. AddNode(aNode, myRootNode); 25. } 26. } 27. } 28. } 29. re

update page after editing sitemap

Hey guys have written the following code to allow authorised users to add categories to a shopping catalog:    Sub editXml()        If txtNewCat.Text.Count > 0 Then            Dim sMap As New XmlDocument            sMap.Load(Server.MapPath("App_Data/Web.sitemap"))            Dim doc As XmlNode = sMap.ChildNodes(1)            Dim root As XmlNode = doc.ChildNodes(0)            Dim pNode As XmlNode            For Each node As XmlNode In root.ChildNodes                If node.Attributes(0).Value = "Catalog.aspx" Then                    pNode = node                    Dim nNode As XmlNode = sMap.CreateNode(XmlNodeType.Element, "siteMapNode", Nothing)           &nb

how to make a dynamic sitemap

HelloI need to make a sitemap with all the products i have in database.I can make it easly in aspx web file, but is it better if i make it in Web.sitemap file? Would search engines find it?And if is better to make it in Web.sitemap, how can i create siteMapNode for each product i have (and i add) in database?Please help meThank you

Access SiteMap Provider

Hi I was trying to implement an access sitemap provider by taking this code: http://msdn.microsoft.com/en-us/library/ms178434.aspx Can one use this example without any further codings? In fact my testwebapp didn't work and I don't know now, if the code needs to be modified since I want to have the same kind of a provider as I have with the standard provider (xml file). Thanks for your advice.If you have a link with a fully functional access sitemap provider it would be great too. Patrick 

SiteMap Path

 Hello    In my site I had used Site Map Path to display the hierarchy in site. Now, the Client wants the Site in two languages. So, I just want to know how to display the Site Map Path hierarchy in other language, when one selects the language from dropdown.  Thanks.

Sitemap disappears almost daily after moving to .NET 4.0

We have the following problematic behaviour on our production server (.NET 4.0, Windows Server 2003, IIS 6.0): Almost every morning, the users will complain that the sitemap used for navigating has disappeared. We use the standard SiteMapPath control, with a static XML file that contains the site structure. Reycling the application pool resolves the problem.I was unable to find any obviously related error messages in the event logs. The sitemap did not disappear when we used .NET 3.5, now we use .NET 4.0. The users most often access reports using ReportViewer 2010 in local mode (loading rdlc files)As of now,we are unable to reproduce the behaviour on our test system, but since we don't have dedicated test users, the test server is idle most of the time. If it has to do with recycling the app pool, maybe it only happens under load, I don't know.Can anyone suggest an approach on how to get to the source of the problem? Reverting to 3.5 would take a lot of effort since we already depend on 4.0 in some places.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend