提交表单时我没有收到任何数据。我希望Request.Form.Count=2
,而是RequestForm.Count=0
。
任何帮助将不胜感激。
<%@ Page Language="VB" EnableViewState="false" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="ecomm_Default2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<form id="form1" method="post">
<input id="textfield" type="text" value="My Text" />
<input type="submit" value="Send it" />
</form>
</body>
</html>
部分背后的代码
Imports System.Diagnostics
Partial Class ecomm_Default2
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Request.HttpMethod = "POST" Then
Debug.WriteLine(Request.Form.Count)
End If
End Sub
End Class
答案 0 :(得分:1)
您输入的字段缺少名称。确保添加它们:
<input id="textfield" name="foo" type="text" value="My Text" />
<input type="submit" name="bar" value="Send it" />
现在,在服务器上,您将获得foo
和bar
个键及其各自的值。