【发布时间】:2016-07-09 15:52:51
【问题描述】:
我有一个 ASP.NET 网站,它运行良好,直到今天早上。 我的所有用户都无法登录!
我花了一天的时间试图解决这个问题,但运气不佳。
现在,我已将问题缩小到 IIS 不接受 POST 数据。
每次用户 POST 的用户名和密码时,它都会为数据的 Request.Form 部分返回 NULL。
在我的 Dev 机器上,它的工作方式与往常一样。我什至可以使用Request.Form.Allkeys 来显示所有正在发送的数据。
我使用了谷歌浏览器的开发者工具来检查 POST 请求是否真的被发送了,是的,它和数据一起发送。
当我的 ASP.NET 代码拾取它时,IIS 似乎不接受任何内容或根本不保存 POST 数据
这是我的登录表单:
<section id = "loginForm" >
<form name="mainLog" method="post">
@* If one or more validation errors exist, show an error *@
@Html.ValidationSummary("Log in was unsuccessful. Please correct the errors and try again.", excludeFieldErrors:=True, htmlAttributes:=Nothing)
<fieldset>
<legend>Sign in to Your Account</legend>
<ol>
<li class="email">
<label for="email" @If Not ModelState.IsValidField("username") Then @<text> class="error-label" </text> End If>Username</label>
<input type="text" id="username" name="username" />
@* Write any user name validation errors to the page *@
@Html.ValidationMessage("username")
</li>
<li class="password">
<label for="password" @If Not ModelState.IsValidField("password") Then @<text> class="error-label" </text> End If>Password</label>
<input type="password" id="password" name="password" />
@* Write any password validation errors to the page *@
@Html.ValidationMessage("password")
</li>
<li class="remember-me">
<input type="checkbox" id="rememberMe" name="rememberMe" value="true" checked="@rememberMe" />
<label class="checkbox" for="rememberMe">Remember me?</label>
</li>
</ol>
<input type="submit" value="Log in" />
</fieldset>
</form>
</section>
以下部分显示了我在哪里获取此 POST 数据:
If (IsPost) Then
If Validation.IsValid() Then
' Attempt to log in using provided credentials
'Recive username and password from form
username = Request.Form("username")
password = Request.Form("password")
在我的本地开发盒上,这绝对没问题,用户名和密码已被接收和处理。但是,在我的实时 IIS 8 服务器上,它们总是显示为空,并且没有数据键。
这是一个请求示例(在 BASH 中):
-H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Referer: ' -H 'Connection: keep-alive' -H 'DNT: 1' --data 'username=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' --compressed
用户名数据正在发送,但Request.Form.AllKeys 根本没有显示任何数据!
就像我提到的,在本地,我没有这样的问题
如果能帮助我的网站重新上线,我们将不胜感激!
【问题讨论】:
标签: asp.net vb.net iis post razor