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()
Clear()
_nodes.Clear()
_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)
Smap.Refresh()
Im really going crazy with this one, any help would be appriciated
Member
55 Points
260 Posts
Problem with SqlSiteMapProvider after converting to VB.net
Jun 03, 2013 12:54 PM|urir10|LINK
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
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
Im really going crazy with this one, any help would be appriciated
Member
55 Points
260 Posts
Re: Problem with SqlSiteMapProvider after converting to VB.net
Jun 04, 2013 10:22 AM|urir10|LINK
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!