asp.net - Ignoring specific query string parameters in custom sitemapprovider -
i’ve written own staticsitemapprovider builds dynamic site map. problem have pages have additional parameters in query string need ignore.
public overrides function findsitemapnode(byval rawurl string) sitemapnode dim startpos integer = 0 dim endpos integer = 0 if rawurl.contains("pagetype=") startpos = rawurl.indexof("pagetype=") endpos = rawurl.indexof("&", startpos) + 1 if endpos >= startpos 'not last param rawurl = rawurl.remove(startpos, endpos - startpos) else 'must last param rawurl = rawurl.remove(startpos) end if end if return mybase.findsitemapnode(rawurl) end function
i've overridden findsitemapnode function takes in httpcontect object. simple find url of request , run though same function above.
however sitemappath (which bound site map) returns nothing on every page.
in end turned out simple fix. needed check see if the parameter first in url. if wasn't, aslo needed remove ampersand - startpos - 1
cheers
Comments
Post a Comment