C# - How To Use SiteMap More Efficiently

May 15, 2010

So, in our website we are using SiteMap. For each request we render some menu and to do that we do SiteMap.RootNode in the helper function.

Now, when I have done the profiling of my website using dotTrace, I saw the get_RootNode() is taking lot's of time(around 70-75 millisecond). But we know that the SiteMap is static. So, I am thinking in somehow I will get the SiteMap.RootNode only once in Application_Start and will access that through out each request.

So, my questions are,

Is my approach correct?

How should I do that?

Or is there any efficient way that I can use SiteMap.RootNode

View 1 Replies


Similar Messages:

Web Forms :: Parser Error Message - XML Sitemap Config File Web.sitemap Could Not Be Loaded

May 11, 2010

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.

View 5 Replies

Sitemap Randomly Breaks Over Time / Could Not Find The Sitemap Node With URL '~/Default.aspx'

Aug 2, 2010

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:

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
<siteMapNode roles="*" title="EG">
<siteMapNode url="~/../SM/Default.aspx" title="Welcome" description="" roles="*" />
<siteMapNode url="~/../SD/Default.aspx" title="SD" description="" roles="*" />
<siteMapNode url="~/../SMD/Default.aspx" title="SMD" description="" roles="*" />

[code]...

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.

View 1 Replies

Find A String And Replace It More Efficiently

Jul 3, 2010

Situation: I have a html file and I need to remove certain sections. For Example: The file contains html:

<div style="padding:10px;">First Name:</div><div style="padding:10px; background-color: gray">random information here</div><div style="padding:10px;">First Name:</div><div style="padding:10px; background-color: gray">random information here</div>

I need to remove all text that starts with "<div style="padding:10px; background-color: gray">" and ends with "</div>" so that the result would be:

<div style="padding:10px;">First Name:</div><div style="padding:10px;">First Name:</div>

I created 2 functions that do this, but I do not this it efficient at all. I have a 40mb file and it takes the program about 2 hours to complete. Is there a more efficient way to do this? Is there a way to use regex? See my code below:.....................

View 1 Replies

SiteMap Change SiteMapProvider / Create Multiple Web.sitemap Files?

Jan 25, 2011

I've got a custom menu navigation built from a web.sitemap file, the first line of this would be something like:

SiteMapNodeCollection topLevelNodes = SiteMap.RootNode.ChildNodes;

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.

View 2 Replies

MVC :: MVC-3 -- How To Efficiently Connect Children To Parent In The View

Feb 13, 2011

I have a parent/child relationship that I'm currently pulling via the EF .include() method and displaying via two foreach loops in my view -- the first foreach loop is for the parents and the second is nested inside each parent and is for the children of that parent.

This has worked fine, but now I need to display information about each child that is not contained in my main child table. The table that contains this extra information only has a relationship to the main child table and thus there is no association between this table and the main parent table --- i.e. the .include() method can't pick this up. I've looked, found nothing and thus assume that I can't have two .include methods chained together. (even if I could, would this be efficient?)

I know I can perform a simple join and pull all of the child information with the parent records, but that would create issues with my paging because I want the page size determined by the number of parent records displayed. For some parents, there are only two children; other parents may have 10 children. So a simple join would create records where the parent information is duplicated and would throw off the paging.

Ideally I'd like to pull the parent information and pull the children information and connect the two when the view is populated, but I don't have a clue on how to do this efficiently (if that's even possible).

View 8 Replies

C# - How To Efficiently Send Large Files From The Database To The Browser

Jun 1, 2010

In my web application I am working with files. Some files are very large. I use Response.Write() to write the file to the browser. This goes well for the smaller files, but for large files this can take a while and the bandwidth is fully used.

Is it possible to split large documents and send it piece by piece to the browser? Are there other ways to send the document quicker to the browser?I hold the document as a property of an object.

View 6 Replies

Efficiently Get All Client Form Data For Manipulating During Raisecallback

Sep 9, 2010

I'm trying to get most of the data I have on my web page, to update a query during an asp 2.0 raisecallback event. I've tried Request.Form with no luck. I've got the html (sent in raisecallback parameter) using 2 div tag's innerhtml. Can someone tell me an efficient method to use to get all this data for updating - Do I have to parse from the callback string (eventArgument) & if so can I use a reader of somekind, or is there a better way?

View 4 Replies

Efficiently Finding Unique Values In A Database Table?

Feb 11, 2010

I've got a database table with a very large amount of rows. This table represents messages that are logged by a system. Each message has a message type and this is stored it it's own field in the table. I'm writing a website for querying this message log. If I want to search by message type then ideally I would want to have a drop down box listing the message types that have come up in the database. Message types may change over time so I can't hard code the types into the drop down. I'll have to do some sort of lookup. Iterating over the entire table contents to find unique message values is obviously very stupid however being stupid in the database field I'm here asking for a better way. Perhaps a separate lookup table which the database occasionally updates listing just the unique message types that I can populate my drop down from would be a better idea.

The platform I'm using is ASP.NET MVC and SQL Server 2005

View 9 Replies

C# - Efficiently Removing Naughty Words From Users Comments?

Oct 25, 2010

I have an ASP.NET app that accepts users comments and them in a SQL database. I want to make sure that I weed out any "naughty" words so I can keep my app respectable. Problem is that I'm finding there are LOTS of these words. ;>My question is, what's the most efficient way to do this processing? Should I have a table in SQL and write a stored proc that does the work? Should I do it with c# and Regex in memory on the web server? Are there other options? Has anyone else successfully done this kind of text scanning at scale? If y, what worked?

View 4 Replies

C# - How To Get The Name Of Sitemap File From Sitemap Provider

Oct 6, 2010

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.

View 1 Replies

Web Forms :: Programmatically Reference .sitemap File That Isn't The Root Web.sitemap File?

Nov 4, 2010

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).

View 1 Replies

Web Forms :: Sitemap Node - Seond Line Of Sitemap Node Won't Indent?

Mar 25, 2010

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:

Parent Node

Second node

line 2 of second node

I want it to be like this:

Parent Node

Second Node

line 2 of second node

View 4 Replies

C# - Localize The Url For A Sitemap?

Jun 4, 2010

I have 2 links, one english one spanish. is there anyway i can localize that in .net? I was thinking of using sitemap

View 1 Replies

Web Forms :: Call One From 2 Web.sitemap On Web App?

Nov 9, 2010

I have a website, on the root i have web.sitemap that works fine for the web users, i have an admin area that is in a sub folder, ths second we.sitemap is on this sub folder how can i call this one ?

View 3 Replies

How To Add Sitemap In Website With Contents

Oct 19, 2010

I want to add a site map to my website however I am a little unsure as to its contents.

Basically I have a simple site with only 5 pages, the site uses a navigation bar which is generated from a master page and is therefore visible on every page.

This means every page is navigatable from very page. In addition some pages also link to the other pages through key words in the text.

So back to the site map.

[code]....

View 2 Replies

Show Submenu With Sitemap?

Jan 10, 2011

how to show submenu with sitemap in asp .net? where is wrong?

<asp:SiteMapDataSource ID="SiteMapDataSource1" StartingNodeOffset="-2" ShowStartingNode="false" StartFromCurrentNode="true" runat="server" />
<asp:Menu ID="Menu1" runat="server" BackColor="Transparent"
DataSourceID="SiteMapDataSource1" DynamicHorizontalOffset="2"
Orientation="Horizontal"
DynamicEnableDefaultPopOutImage="False"
StaticEnableDefaultPopOutImage="False"
EnableViewState="False"
staticdisplaylevel = "2"
dynamicdisplaylevel = "2"
Font-Names="Verdana" Font-Size="1.2em" ForeColor="#666666"
StaticSubMenuIndent="30px">
<StaticSelectedStyle BackColor="Transparent" />
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DynamicHoverStyle BackColor="LimeGreen" ForeColor="White" />
<DynamicMenuStyle BackColor="#E3EAEB" />
<DynamicItemTemplate>
<%# Eval("Text") %>
</DynamicItemTemplate>
<DynamicSelectedStyle BackColor="#1C5E55" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<StaticHoverStyle BackColor="LimeGreen" ForeColor="White" />
</asp:Menu>
<siteMapNode url="~/hello.aspx" title="Start" description="" >
<siteMapNode url="~/Default.aspx" title="Home" description="" />
<siteMapNode url="~/Daily_Transaction.aspx" title="Pay fee" description="" />
<siteMapNode url="~/EditCompanyMaster.aspx" title="Update Company Name" description="" />
<siteMapNode url="~/Report_Selection.aspx" title="Report" description="">
<siteMapNode url="~/DailyReport.aspx" title="Daily Report" description="" />
</siteMapNode>
</siteMapNode>

View 1 Replies

How To Bind TreeView With Sitemap

Mar 21, 2011

I have a Sitemap and I am planning to query it programmatically and filter it, something likefrom SiteMapNode smnode in SiteMap.RootNode.GetAllNodes()
..do somethingMy question is how do I approach the above. I mean on what event can I query it and how to then bind it to the TreeView?

View 1 Replies

Web Forms :: Page Url In Web.sitemap

Feb 16, 2010

Im using url rewriting and i want to use web.sitemap, so how can give the url of page since it virtual?

View 2 Replies

Web Forms :: Sitemap - Same URL For More Than One Sitemapnode?

Jul 28, 2010

i created a web.sitemap file where I have listed the following:

[Code]....

I need to set some values before the menu item navigates to the page. I'd like to use the same aspx page for more than one menu item and I'd like to avoid the use of querystrings in my code. However, I realize that it's not possible to set the same url in the web.sitemap file. If I don't specify a url, the menu item created is not click-able.

View 6 Replies

Developing A Web Site On The Web.sitemap?

Jun 30, 2010

I'm developing a web site and on the web.sitemap i define which roles can access a certain page, is it possible to know on the page which are the role associated to then on the web.sitemap

View 1 Replies

Web Forms :: Can Use 1 Sitemap For Two Different Websites

Feb 24, 2011

I took over my company's website and I'm reordering the layout and colors. I can't change the structure of the websites. It's one website but it has two different parts. A static part sits on one server and the part the users login is on another server.

What I would like to know is if can use one sitemap for both so I don't have to maintain two. I also want to generate a site map dynamically and I can't do that with two different sitemaps.

View 1 Replies

Add A MVC2 And SiteMap Provider

Apr 24, 2010

I've tried this guide: http://mvcsitemap.codeplex.com/Thread/View.aspx?ThreadId=208090I've added dll "MvcSiteMap.Core.dll" i referencesAnd I've added namespaces in web.config: "<add namespace="MvcSiteMap.Core" />"When I'm entering the web page comes this message:

Line 49: </runtime>Line 50: Line 51: <siteMap defaultProvider="MvcSiteMap">Line 52: <providers>Line 53: <add

View 3 Replies

C# Change Sitemap From Ashx To Xml?

Mar 7, 2011

sitemap is at: http://localhost/scirranew/sitemap.ashx

<%@ WebHandler Language="C#" Class="SiteMap" %>
using System;
using System.Web;

[code]...

View 1 Replies

C# - Retrieve Sitemap From Database?

Jun 15, 2010

How to reterive sitemap from databse in asp.net?Can somebody can provide any link which explain the process.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved