Web Forms :: Sitemap Title Attributes Not Displaying
Mar 19, 2010
I created a sitemap that works perfectly for my menu and when rendering the sitemappath for a breadcrumb style nav on a masterpage. But when I create a page to display the full sitemap in a treeview, the title attributes do not display. Instead, all I see is the word 'sitemapnode'. Here is a snippet of 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="Home">
<siteMapNode url="EmergencyMedicalServices/services.aspx" title="Services" description="Emergency Medical Services">
<siteMapNode url="EmergencyMedicalServices/AmbulanceServices.aspx" description="Lifenet Ambulance Services" title="Ambulance Services"/>
<siteMapNode url="EmergencyMedicalServices/dispatchandcommunications.aspx" description="Lifenet Dispatch and Communication Services" title="Lifenet Dispatch and Communication Services">
<siteMapNode url="EmergencyMedicalServices/emergencymedicalservices_callcenter.aspx" description="LifeNet Call Center Process" title="Call Center Process"/>
</siteMapNode>
<siteMapNode url="about.aspx" title="About Lifenet" description="About">
</sitemapnode>
</sitemap>
Here is the code for the page displaying the sitemap:........................
I have a some code that I have used to set the page title from the sitemap on my root.master. I also use very similar code to add a titlebar from sitemap on my nested.master. Im just getting starting to try to build classes and was wondering if there is a way to make this into a class and then referance it in each master/nested master?
Also it errors out if the is no Title attribute in the node, is there anyway to test if it exists first?
Is there a way to display an image within a sitemap node, so that the image will display in my menu? I have a series of nodes that open external webpages, and I would like to display a small icon next to the text of that node so that a user knows that link will open a new window. I've seen this done on other sites using aspx, but can't figure out how it's done.
We are getting this error message when we try to click the link in the menu to go to Report Server:
Source Error: Line 31: <siteMapNode title="Reports" description="Reports"> Line 32: Line 33: <siteMapNode url="https://ffxsqldgc01.ffx.co.fairfax.va.us/Reports/Pages/Folder.aspx?ItemPath=%2fDPZ&ViewMode=List" title="View Reports" description="Click here to view the reports" /> Line 34: </siteMapNode> Line 35:
I tried to add after the &, as it was suggested on one of the forum but it did not work. Any other ideas.
I am accessing this xml file by using LINQ to XML in asp.net by using C#. I am able to access all the attributes of an XML node by explicitly specifying the name of the attribute. I want to write query on this xml file which reads all the attribute values of the xml node (In our example the node is SERVER) dynamically means I want to write the query which can read the read the value of the attribute Name & ID from first node, only name from second row, Name, ID & Parent from the third row , Name & ID from the fourth row, Name, Parent & Value from the fifth row & only Name from the sixth row without modifying the existing code every time. Once I add one of the attribute ( for example if I add the attribute ID in the sixth row ) in the above xml file then I dont need to modify my LINQ to XML query. My query should dynamically fetch the total number of attributes & display their values. Is their any way to do this ?
I've been having some production runtime errors that I don't fully understand. This has happened to us on a couple different ASP.NET 4.0 Web Sites (shudders - yes, I know - we're porting it to MVC but that's taking some time).
First of all, we have never been able to reproduce this issue in development/QA environments. Secondly, upon deployment, the issue seems to be non-existent. Sometimes the issue manifests within a day or two of deployment and other times the deployment will be live for a month without it manifesting at all. However, once it manifests, then ANY page viewed under the web site causes the error. Lastly, this problem seemed to only come up once we migrated to .NET 4.0. We started at 2.0, a year ago upped to 3.5, and recently upped to 4.0 with this solution and most child projects.
The error:
Could not find the sitemap node with URL '~/Default.aspx'.
A simplified version of our sitemap (with some names changed and uninteresting nodes removed) is as follows:
I have confirmed in all of the SiteMaps that there is a node with url="~/Default.aspx" with roles="*" (which includes public/anonymous access), so I am very confused as to why this problem occurs.
SiteMap does not have a node for Default.aspx. All of them do. SiteMap's Default.aspx node is not accessible for security reasons to the current user/role. They're all accessible to anonymous users and this problem even exists for super admin users. Passed-in URL contains querystrings (Default.aspx?abcd). I don't know if this is a problem (I sure would hope not) but once the problem manifests itself, I can handwrite the URL with no querystrings and the problem still exists.
SiteMap changes. It doesn't Service's permissions to the sitemap file. The sitemap works perfectly fine after a deployment, so unless permissions are changed in a way that IISRESET fixes, then this is not an issue. The worker process becomes globally corrupt. I don't think so. We have ~12 web sites all in the same app pool and the problem always stays confined within a single web site. Also, we have yet to have this happen to more than a single web site at a time although it has manifested itself in 4 different ones so far.
However, now I want to be able to create multiple web.sitemap files, and then programmatically determine which web.sitemap file to use, but I can't seem to find out how to do this. I'm assuming I could either create one custom SiteMapProvider that can perform the logic to determine which web.sitemap file to load, or I have multiple providers, each one with the SiteMapFile property set to a specific *.sitemap file, and then switch providers programmatically before I access SiteMap.RootNode.
How would I programatically reference a .sitemap file that is not the root web.sitemap file? I have a file called research.sitemap in a folder a level under root. I want to refernce this file in my code behind like his: SiteMapNode m1 = SiteMap.RootNode (but since this isnt web.sitemap in the root, I dont know how to get access to it).
I have a second level node that goes onto two lines. The first line indents 15px as is set by the class for node level 2. The seond line kicks back to the same level as 1st level nodes. Here's what I mean:
I am creating a CacheDependency on the file that my SiteMap provider uses. I would like to get the name of the file from my sitemap provider instead of hard coding it. Is there a way?
Edit
Duh, I forgot to mention: XmlSiteMapProvider that comes with ASP.NET
Edit 2
Reflector shows a private member field called _filename that isn't exposed in any way as far as I can tell.
I have issues when developing under Visual Studio 2010 and getting the favicon.ico to display. I have used favicons in production sites (sites running on Windows Server 2008, for example) and have no issues. But when I try to get it to display when testing new code under Visual Studio 2010, then I have difficulties getting it to display. Then sometimes it will display just fine with no assistance (see next paragraph). Before anyone says it...Yes, I have a file in the root directory called "favicon.ico". No, it will not display (in certain projects) when the site is run under VS2010...UNLESS I TREAT THE URL IN THE BROWSER THE SAME AS WHEN RUNNING UNDER FIDDLER2. That is to say, it will only work if I add a period character (.) in the url after the "localhost" entry [URL]. This url will cause the favicon to display every time. If I leave out the period (.), then the favion will not display -- and Fiddler2 will also not display the activity when the page is displayed/refreshed. As I said, this is a sporadic issue. I have some projects where the favicon displays fine. Then I have others where it does not...unless I put the period in the url after the locahost word. Can someone explain to me why:
(a) The period is required in the url to get Fiddler2 to "catch" the activity;
(b) Why does this same phenomenon affect the favicon as well; and,
(C) Why do some projects display the favicon fine when run under VS2010 WITHOUT the period being added?
I just do not understand what the period character in the url string is actually causing to happen and why it doesn't happen when it's missing.
.Net 4.0 is encoding values when using Attributes.Add. In previous versions it didn't. With the new behaviour it is no longer possible to write attributes containing single quotes.Here's an example.
I am giving Title of page Using Title tag in @Page directive. But after getting rendered the title is not getting displayed in one line. i.e. it displayed like the following:
<title> Title to display </title>
I Want this title to display in one line i.e.
<title> Title to display</title>
I have tried giving title through code behind but it also displays in that manner. My website application contains one master page and others are its content page. so i cant use title tag in those content pages.
Also is there any regular expression i can use to remove new line from rendered page.
I have used following regular expression
Match m = Regex.Match(strHTML, "<title>(.*)</title>"); if (m.Groups.Count == 2) return m.Groups[1].Value; return "(unknown)";
if returns 'unknown' if there is newline in title.
Is there any way to edit this regex so that i can remove newline from title.
I am using 150 Screens, and also i using one class file... now i want the Page Tiltle for 150 screen.. its not possible to write in 150 screen.. so i want to write the code in class file.. how to write the code in class file, for getting the page tiltle?
My question is whether it is possible or not to extract the "is_tube_mailer" field from the Treeview's Treenode. I attempted to cast the node.DataItem to an Xmlnode, however that only seemed to work in the TreeNodeDataBound event. I need to do this within a Button.Click event routine.
I have a dropdown that has datain the format "ID Title" sorted on the Title.
Ex data is
122343 Another Example 320078 Machines are fun 953278 This is an example title 145678 Welcome to my world
Now the data in the dropdown is becoming too large. And customers have to scroll down a lot to get to a specific title. What I am trying to do is give links above the dropdown (A, B, C, ...., Z, 0, 1, ...., 9). When A is clicked the dropdown should select the first Title that begins with A and so on.
how to change the title="viewcompanydata" into multilanguage
as when i click arabic button the data inside the title=" " shuld appear in arabic and viseversa,so can one let me know how to do it,as i have done globalization for my whole project,just this part is remaning.