c# - 如何在 ASP.NET MVC 中使用隐藏的 csrf-token 登录
问题描述
我有一个带有以下字段的外部网站的登录表单链接,有用户名、密码和术语字段可见,还有一个隐藏字段是 _token (csrf-token)。如何在单击我当前网站的按钮时自动登录该外部网站。
每次收到响应 419 Page Expired 时,我都尝试了很多解决方案。我当前的网站在 ASP.NET MVC 5 C#
<form id="login" class="login" target="_blank" method="post" action="https://test.com/login">
<input type="hidden" name="_token" value="qwewqewqewqewqewqewq">
<input id="username" name="username" value="" />
<input id="password" type="password" name="password" value="" />
<input id="terms" type="checkbox" name="terms" checked />
<button type="submit"></button>
</form>
解决方案
推荐阅读
- react-native - 具有两列的容器:第一个具有固定宽度,第二个具有 flex grow
- reactjs - recharts折线图未呈现
- javascript - 如何在 JEST 中测试并行的模拟数据请求,同时以 500 毫秒的阈值模拟缓存响应
- oracle - 如何使用 oracle 在没有数据的情况下生成脚本(就像我们在 sql server 中所做的那样)?
- python - 如何在“https://www.drugs.com/”的所有html文件的标题下刮掉与ID相关的ID和文本?
- python - 如何在 numpy 选择概率中重复一个值
- uitableview - 在重新加载表格时保持 UISwipeActionsConfiguration 打开
- web-services - Prestashop Webservice 或过滤器键上的运算符
- google-analytics - 为什么来自广告的数据与分析中的数据不同?未显示广告用户和点击次数
- python - 为什么我的班级没有从选择中返回数据?