question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Routes are incorrect when hosted in Virtual Directory

See original GitHub issue

Related 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.

image

I’ve just modified the MvcWeb application in the examples folder to debug this: image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
tidyuicommented, Jul 28, 2020

I added a comment to your PR!

1reaction
tidyuicommented, Jul 26, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found