ASP.Net Core 6.0 OnGet handler not called when an anchor link is clicked
تبليغيرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.
I have the following html piece of code, which holds several links:
<div class=”footer-left”>
<ul>
<li><a href=”/About”>About</a></li>
<li><a href=”/Privacy”>Privacy Policy</a></li>
<li><a href=”/CookieList”>Cookies List</a></li>
<li><a href=”/Terms”>Terms of use</a></li>
</ul>
</div>
Then I have an OnGet handler for the About page:
public class AboutModel : PageModel
{
private readonly DbDuhnjaContext mDataContext;
public AboutModel(DbDuhnjaContext aDataContext)
{
mDataContext = aDataContext;
}
public void OnGet()
{
// Some code
}
}
When I open the page by typing its path in the browser: https://mywebsite.com/About or refresh the page, it calls the OnGet method correctly. But if I click on the link it does not calls the method.
What am I missing here?
Best Regards
أضف إجابة