Problem with SqlSiteMapProvider after converting to VB.net RRS feed

  • Question

  • User564488466 posted

    Hi all,

    I hope this is the right place to post this.

    I have converted the SqlSiteMapProvider (from WickedCode) into VB.Net. I have configured everything as needed and it worked fine.
    I then had to modifiy the store proc that gets the map with a CTE so that i can use nested roles  and because of that i can not use the SQL Cache any more to keep the menu up to date. 
    What i then did is create a Refresh function as you can see below and i tried to refresh the map from within the code (All of that worked fine in C#) but now i get an error saying "Unable to cast object of type 'SqlSiteMapProvider' to type 'NameSpace.SqlSiteMapProvider'."
    The site map still loads but doesnt refresh properly.

    Here is my code:

    Refresh function

    Public Sub Refresh()
            _root = Nothing
        End Sub

    Page_Load event: 
    when i run in debug mode and check the value of SiteMap.Provider it clearly shows 'SqlSiteMapProvider' but it wont let me cast it to the smap object so i cant call the refresh function 

    'ERROR HERE: "Unable to cast object of type 'SqlSiteMapProvider' to type 'NameSpace.SqlSiteMapProvider'."
    Dim Smap As SqlSiteMapProvider = CType(SiteMap.Provider, SqlSiteMapProvider) 

    Im really going crazy with this one, any help would be appriciated


    Monday, June 3, 2013 12:54 PM


  • User564488466 posted

    Found my stupid problem.

    I had the sqlsitemapprovider.vb file in the App_Code folder of a WAP which wont work. Moved it out to a different folder and voilla!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 4, 2013 10:22 AM