L
L
Leonid2021-12-08 07:09:07
ASP.NET
Leonid, 2021-12-08 07:09:07

Why doesn't the method work in RAzor PAge?

Created a default Core Web Razor Page application from Visual Studio

added a handler to index

public void OnTest()
        {
            _logger.LogInformation("Hi");
        }


Added a link But it calls the default OnGet Maybe something else is needed, but there seems to be nothing more in the documentation and examples
<a asp-page-handler="OnTest" >test</a>


Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2021-12-08
@caballero

Incorrectly named handler
should be, judging by the documentation

public void OnGetTest()

<a   asp-page-handler="test" >test</a>

https://docs.microsoft.com/en-us/aspnet/core/razor...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question