我在.net core C#中使用如下模型创建了一个简单的登录页面:
public string UserEmail { get; set; }
public string UserPassword { get; set; }
就像这样在我的剃须刀页面上设置它:
<input type="email" id="email-user" class="form-control mb-4" asp-for="UserEmail" placeholder="E-mail">
<input type="password" id="password-user" class="form-control mb-4" asp-for="UserPassword" placeholder="Password">
用户单击按钮后,他会转到下一页,但URL包含他的电子邮件和密码,如下所示:
https://localhost:44306/User/Welcome?UserEmail=sampleemail%40gmail.com&UserPassword=dasdasdsa
答案 0 :(得分:0)
我相信您正在使用GET请求,而您想使用POST请求。
在GET请求期间,可以发送参数以发送URL。
在POST请求中,您可以将参数发送给请求的正文。
请咨询what-is-the-difference-between-post-and-get和this doc以获得有关HTTP协议的更多详细信息。