Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

How to invoke XMLSiteMapProvider in login page (logged_in method)?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
alexandis - 02 Feb 2008 21:03 GMT
I use additional custom attributes in sitemapnodes of my web.sitemap,
besides - it contains startUrl to navigate to when leaving login page,
depending on role.

<siteMapNode startUrl="Clients/clientlist.aspx" title="Clients"
roles="admin,partner" startFor="admin,partner">

All in all - i need to invoke my custom xmlsitemap provider in
logged_in event of login control to access my custom methods and
properties. But i have no idea how to do this! I create my provider
instance in logged_in event (i suspect i shouldn't do this directly)
and when I try to call its custom method - i'm getting:

"XmlSiteMapProvider is not initialized. Call Initialize() method
first".
alexandis - 02 Feb 2008 21:41 GMT
Ok, i tried something like this:
        WizardsSiteMapProvider wizardsSiteMapProvider = new
WizardsSiteMapProvider();
        NameValueCollection providerAttributes = new NameValueCollection();
        providerAttributes.Add("siteMapFile", "Web.sitemap");
        providerAttributes.Add("securityTrimmingEnabled", "true");
        wizardsSiteMapProvider.Initialize("AdminSiteMapProvider",
providerAttributes);

- but base.RootNode.ChildNodes return 0 elements for some reason! :(
alexandis - 03 Feb 2008 07:20 GMT
BuildSiteMap() follows Initialize method - just calling
base.BuildSiteMap().

Then I call my custom method, where I check base.RootNode.ChildNodes.
And it shows zero, although it should be filled from web.sitemap :(

Changing to providerAttributes.Add("siteMapFile", "~/Web.sitemap")
didn't help
alexandis - 03 Feb 2008 09:05 GMT
Hi, myself,

you should not assign securitytrimmingenabled section and then you
will see all the child nodes.
Also please be aware, that at login page isAuthenticated is false,
etc. Take this into account when doing role checks inside your custom
method.
alexandis - 03 Feb 2008 12:17 GMT
Moving further... Ok, now i'm inside, redirected to correct page. And
need to make there a 'program click' on asp:menu item. Hmm, how to do
this...
alexandis - 03 Feb 2008 12:35 GMT
Well... instead of additional 'click' i may just make a check in
master page_load:
if (!isPostBack) {
// highlight menu item, knowing its Url
// MenuItem menuItem = FindMenuItemByUrl(menuobj, Url);
// menuItem.Selected = true;
}
But my custom recursive FindMenuItemByUrl as yet doesn't work
properly: it does return correct item, but some parent folders are not
opened, although i use expand method... Strange.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.