Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.UsePiranha(options) middleware ruins route search #1816

Closed
Hockwell opened this issue Jan 28, 2022 · 1 comment
Closed

.UsePiranha(options) middleware ruins route search #1816

Hockwell opened this issue Jan 28, 2022 · 1 comment
Assignees

Comments

@Hockwell
Copy link

Hockwell commented Jan 28, 2022

  • Issue: Html.Action, Html.BeginForm,...,Url.Action() generate a default route to action (ControllerName/ActionName?params), but not a special route from .MapControllerRoute()-methods (attribute-based routes work fine). Issue was discovered after migration from 3.1 to .net 6 and piranha 10.

Example (I have a lot more examples): for this rule LinkGenerator API generates Purchase/Buy

endpoints.MapControllerRoute(
         name: "Buy",
         pattern: "api/purchase/buy/",
         defaults: new { controller = "Purchase", action = "Buy" }
         );
  • Mitigation: using old piranha middleware, for example: .UsePiranhaManager(), .UsePiranhaTinyMCE(), .UsePiranhaIdentity() instead of UsePiranha().
@tidyui tidyui added this to the Version 10.0.3 milestone Feb 8, 2022
@tidyui tidyui self-assigned this Feb 11, 2022
@tidyui tidyui closed this as completed in 5c2c887 Feb 12, 2022
@tidyui
Copy link
Member

tidyui commented Feb 12, 2022

The problem here was that there is a problem with calling UseEndpoints() multiple times. To amend this we have added a UseEndpoints() method to the PiranhaApplicationBuilder that will add the endpoint actions to a collection and then call them all in one go. This method can be called from within UsePiranha(), for example:

public void Configure(...)
{
   ...

   app.UsePiranha(options =>
   {
      options.UseEndpoints(endpoints => ...);
   });
}

@tidyui tidyui modified the milestones: Version 10.1, Version 10.0.3 Mar 31, 2022
@tidyui tidyui changed the title .UsePiranha(options) middleware ruins searching in routes (LinkGenerator API) .UsePiranha(options) middleware ruins route search Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants