This question is locked. New answers and comments are not allowed.
Kevin Watkins
Top achievements
Rank 1
Kevin Watkins
asked on 07 Apr 2010, 05:43 PM
Hi,
I have my MVC application at /Mvc. (E.g. http://localhost/Mvc) I have an ASP.NET app at /App. When I use the Url property and set it to anything under /App (e.g. "/App/MyPage.aspx") the nodes suddenly disappear from my tree! Any thoughts?
Looking around the code with Reflector I noticed the NavigatableExtensions.IsAccessible method. Could this be the cause of the problem? Note that the URL is accessible, i.e. it's in the sitemap for the MVC site and I have the relevant permissions. Is there anyway to turn this security trimming off if it is the problem?
Cheers,
Kev
I have my MVC application at /Mvc. (E.g. http://localhost/Mvc) I have an ASP.NET app at /App. When I use the Url property and set it to anything under /App (e.g. "/App/MyPage.aspx") the nodes suddenly disappear from my tree! Any thoughts?
Looking around the code with Reflector I noticed the NavigatableExtensions.IsAccessible method. Could this be the cause of the problem? Note that the URL is accessible, i.e. it's in the sitemap for the MVC site and I have the relevant permissions. Is there anyway to turn this security trimming off if it is the problem?
Cheers,
Kev
5 Answers, 1 is accepted
0
Accepted
Hello Kevin,
The method which verifies URL accessibility is System.Web.SiteMapNode.IsAccessibleToUser method.
It will be called if the url contains "~/" or "/". Unfortunately there is no property, which will allow you to stop the verification. You need to patch the code like this:
Telerik.Web.Mvc.Infrastructure.Implementation.NavigationItemAuthorization.cs file:
Change IsAccessibleToUser method with with this one:
Nevertheless I will forward this issue to our developers for further investigation and consideration.
Sincerely yours,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
The method which verifies URL accessibility is System.Web.SiteMapNode.IsAccessibleToUser method.
It will be called if the url contains "~/" or "/". Unfortunately there is no property, which will allow you to stop the verification. You need to patch the code like this:
Telerik.Web.Mvc.Infrastructure.Implementation.NavigationItemAuthorization.cs file:
Change IsAccessibleToUser method with with this one:
public bool IsAccessibleToUser(RequestContext requestContext, INavigatable navigationItem){ Guard.IsNotNull(requestContext, "requestContext"); Guard.IsNotNull(navigationItem, "navigationItem"); bool isAllowed = true; if (!string.IsNullOrEmpty(navigationItem.RouteName)) { isAllowed = controllerAuthorization.IsAccessibleToUser(requestContext, navigationItem.RouteName); } else if (!string.IsNullOrEmpty(navigationItem.ControllerName) && !string.IsNullOrEmpty(navigationItem.ActionName)) { isAllowed = controllerAuthorization.IsAccessibleToUser(requestContext, navigationItem.ControllerName, navigationItem.ActionName); } else if (!string.IsNullOrEmpty(navigationItem.Url)) { isAllowed = true; } return isAllowed;}Nevertheless I will forward this issue to our developers for further investigation and consideration.
Sincerely yours,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Kevin Watkins
Top achievements
Rank 1
answered on 08 Apr 2010, 01:22 PM
Hi,
In my case I'm using a custom site map provider which your UrlAuthorization class doesn't know about; it creates it's own SiteMapProvider and looks for web.sitemap. In my case I have a slightly different implementation of IsAccessibleToUser plus my sitemap is located elsewhere.
Could you maybe use SiteMap.Provider to get the default SiteMapProvider and wrap any extra functionality you need around that?
I'll use the patch in the meantime.
Cheers,
Kev
In my case I'm using a custom site map provider which your UrlAuthorization class doesn't know about; it creates it's own SiteMapProvider and looks for web.sitemap. In my case I have a slightly different implementation of IsAccessibleToUser plus my sitemap is located elsewhere.
Could you maybe use SiteMap.Provider to get the default SiteMapProvider and wrap any extra functionality you need around that?
I'll use the patch in the meantime.
Cheers,
Kev
0
Kevin Watkins
Top achievements
Rank 1
answered on 08 Apr 2010, 01:24 PM
Oh and the last else if can be missed off from the patch as isAllowed is already true.
Kev
Kev
0
Hello Kevin,
The patch actually remove the verification for the Url. You are correct that the isAllowed is already true (I missed that). In that case you can even remove the check for the URL property.
Regarding different SiteMap provider.
Currently our sitemap does not support different providers as the ASP.NET SiteMap provider. Nevertheless you can give your vote here for this feature.
Greetings,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
The patch actually remove the verification for the Url. You are correct that the isAllowed is already true (I missed that). In that case you can even remove the check for the URL property.
Regarding different SiteMap provider.
Currently our sitemap does not support different providers as the ASP.NET SiteMap provider. Nevertheless you can give your vote here for this feature.
Greetings,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Kevin Watkins
Top achievements
Rank 1
answered on 08 Apr 2010, 03:48 PM
Hi,
I wasn't suggesting adding support for different providers, rather that your current code should probably use the existing default provider (if there is one) rather than creating one as that will probably be used for the sitemap.
But then I don't really care either way; in my case I just want to disable the trimming full stop.
Patch works great by the way, thanks.
Cheers,
Kev
I wasn't suggesting adding support for different providers, rather that your current code should probably use the existing default provider (if there is one) rather than creating one as that will probably be used for the sitemap.
But then I don't really care either way; in my case I just want to disable the trimming full stop.
Patch works great by the way, thanks.
Cheers,
Kev