ignoring certain querystring parameters in a custom SiteMapProvider?

D

Don

Hi all,

So i may have painted myself into a corner, am I screwed?

I'm developing a message board for a site I work on, fairly simple
hierarchy. Topics -> Threads -> Posts. As such, I've written a custom
site map provider for my breadcrumb control. Adding SiteMapNodes for my
ViewThreads.aspx (see all the threads in a topic) is simple...


topicNode = new SiteMapNode(this, topic.Name,



string.Format("~/ViewThreads.aspx?topicid={0}",

topic.TopicId),
topic.Name,
topic.Description);

AddNode(topicNode, _forumHome);


And everything works great, until I tried to set up custom paging via
url (to make the page more SEO/google spider friendly). The new paging
setup appends a &page=X to the page's url, thus confusing the
breadcrumb control what page we're on.

So my question, is there any way to tell my sitemapnodes to ignore the
"page" querystring parameter? Barring that, is there another way to do
seo friendly paging (w/o postbacks essentially)?

Thank you in advance.

Don
 
D

Don

Ok, I was able to solve my own problem. For those interested, i was
able to override FindSiteMapNode(string rawUrl) and parse out the
unwanted querystring parameters.

public override SiteMapNode FindSiteMapNode(string rawUrl)
{
if (rawUrl.IndexOf("page=") >= 0)
{
int start = rawUrl.IndexOf("page=");
int end = rawUrl.IndexOf("&", start) + 1;
if (end >= start) //wasnt the last parameter
rawUrl = rawUrl.Remove(start, end - start);
else //it was the last parameter
rawUrl = rawUrl.Remove(start);
}
return base.FindSiteMapNode(rawUrl);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top