0
winson created
I need to dynamic to generate the URL with URL route, because I need to handle the root or subfolder deployment issue, so I want to generate url like below:
UrlHelper url = new UrlHelper(HttpContext.Current.Request.RequestContext);
var menuUrl= url.RouteUrl(new { Controller = "Home", Action = "Index" });
new MenuItemDefinition(
"Home",
new FixedLocalizableString("Home"),
url: menuUrl,
icon: "fa fa-home",
UserRole.JOURNALIST
)
but it's can't get the HttpContext.Current.Request.RequestContext in NavigationProvider class, so any ideas?
Thanks!
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)
2 Answer(s)
-
0
Hi,
That's not possible since menu is created on application initialization, not per request. You can do it while rendering menu (in razor view).
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
ok, I see, thank you!!
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)