ASP.NET Razor 页面模型绑定不起作用

问题描述 投票:0回答:1
c# asp.net-core razor-pages
1个回答
2
投票

您可以添加此属性

[BindProperty]
,如下所示:

    [BindProperty]
    public string LoginName { get; set; }
    [BindProperty]
    public string Password { get; set; }

    public async Task<IActionResult> OnPostAsync()
    {
        // Login code here
    }

结果:

© www.soinside.com 2019 - 2024. All rights reserved.