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.

Multiple @page on razor pages

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

Im trying to allow this

@page "/test/{id:int?}"
@page "/test/create"

this works with blazor but not works with RazorPages

Describe the solution you’d like

Same behaviour as Blazor @page

Additional context

No response

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ParadiseFallencommented, Feb 14, 2022

@javiercn Thats not a bug for Blazor. Blazor is smart thing and i can use multiple @page for blazor. You can try it on any component. Ill try [HttpGet]. Can you also explain to me how i can use PageConvention to achive that? Im not using folders routing. Im using @page for routing.

1reaction
javiercncommented, Feb 14, 2022

@ParadiseFallen thanks for contacting us.

This is not something we plan to implement in the near future. You might be able to achieve this using @attribute [HttpGet("...")] or placing the route attribute on the model. You might also write your own PageConvention to decide how the route applies.

I don’t believe you can put multiple @page directives in Blazor. That would be a bug

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to have multiple layout pages in a C# razor ...
Is there a way of using one layout file for some pages, and then a different layout files for other pages? ... This...
Read more >
Introduction to Razor Pages in ASP.NET Core
Explains how Razor Pages in ASP.NET Core makes coding page-focused scenarios easier and more productive than using MVC.
Read more >
Using Multiple Handler Methods in ASP.Net Core Razor ...
In this article I will explain with an example, how to use multiple Handler Methods inside Razor Pages in ASP.Net Core.
Read more >
Handler Methods in Razor Pages
You might want to do this if your page features multiple forms, each one responsible for a different outcome, for example.
Read more >
Handle multiple forms in asp net core razor pages - YouTube
NET Core Razor Pages Tutorial https://www.youtube.com/playlist?list=PL6n9fhu94yhX6J31qad0wSO1N_rgGbOPV Angular, JavaScript, jQuery, ...
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