Routes are incorrect when hosted in Virtual Directory
See original GitHub issueRelated to #1273. The application starts after the fix done to IntegratedMiddleware
but routes are incorrect, so navigating to any page except the default site page fails - or even the main page URL is incorrect when clicked in the menu.
HttpContext.Request.PathBase
contains the Virtual Directory path, so I’ve tried to do some changes to make use of that value, but I haven’t found the correct place(s) to modify. It looks like route handling is correct, so the pages are found and rendered correctly if the browser URL points to the <host>/<virtual-directory>/<page>
, however the menu items don’t include the <virtual-directory>
segment.
I’ve just modified the MvcWeb application in the examples folder to debug this:
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
c# - Routing is not working when using virtual directory or ...
We have an api configured and are trying to move the api to an application or virtual directory. Direct access is working fine,...
Read more >Site cannot be loaded after transferred to virtual directory
For the first issue you need to make sure that both the Application Pool identity and any impersonation identity have read access to...
Read more >Virtual Directory <virtualDirectory>
A virtual directory is a directory name (also referred to as path) that you specify in Internet Information Services (IIS) 7 and map...
Read more >How to Fix IIS Virtual Directory Error
Most IIS virtual directory errors can be resolved by resetting or recreating them using Exchange Management Shell. However, to recreate IIS ...
Read more >3 Understanding Oracle Virtual Directory Routing
The Oracle Virtual Directory routing process analyzes LDAP client search filters in addition to traditional adapter suffix comparison and further refines ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I added a comment to your PR!
My guess is the menu can be fixed easily in the project. The templates render the menu like this:
https://github.com/PiranhaCMS/piranha.core.templates/blob/master/src/web/razor/Pages/_Layout.cshtml#L25
Where permalink will start with a forward slash. By adding a “~” before permalink and wrapping it inside @Url.Content() asp.net should resolve the links correctly.
We’re adding some helpers for link generation in 8.4, we’ll try to test for this case as well.
Regards