c# - Form Post 通过 Request.QueryString 而不是 Request.Form 发送值

标签 c# html forms post

这是从标准 HTML 页面中摘录的 HTML:

<form name="login_form" action="http://localhost/BOB.WebPortal/LoginForm.aspx" method="post>
        <div id="content_logins">

            <div id="spacer_ie" style="width:990px; height:7px; border:none; float:left"></div>
            <div style="width:255px; height:22px; border:none; float:left"></div>
            <div style="width:172px; border:none; float:left; vertical-align:bottom">
                    <input type="text" name="uname" id="uname" size="13" /></div>
                <div style="width:110px; border:none; float:left">
                    <input type="password" name="pword" id="pword" size="13" /></div>
                <div style="width:140px; height:22px; border:none; margin-top:-2px; float:left">
                    <!--input class="btbgfix" type="image" src="images/submit.png" alt="Submit" value="Login"-->
                <input name="submit" id="loginButton" class="btbgfix" type="image" src="images/submit.png" alt="Submit" value="Login"></div>
            <div style="width:320px; height:22px border:none; float:left">
                <img name="login" src="x.gif" id="alogin" usemap="#m_login" border="0" width="320" height="22" />
                <map name="m_login" id="m_login">
                    <area shape="rect" coords="0,0,681,22" href="https://www.aetmyportfolio.com.au" target="_blank" alt="Go to AET My Portfolio" />
                </map>
            </div>  

            </div> 
    </form>

我的问题是,我正在尝试使用 Request.Form 从我的 ASP.Net 应用程序中 C# 代码隐藏文件的 Page_Load 事件中检索发布值 uname 和 pword。但是我发现 Request.Form 是空的。但是,如果我使用 Request.Params,那么我可以访问这些值,因为它们在 URL 中作为查询字符串值传递。

我是不是在我的 html 中做错了什么?

最佳答案

假设这是从您的 HTML 中直接复制粘贴的内容,您在“发布”的末尾缺少一个结束引号。

关于c# - Form Post 通过 Request.QueryString 而不是 Request.Form 发送值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/568129/

相关文章:

c# - 从多个 .proto 文件创建一个 .proto 文件

c# - 捕获 HTTP 请求

c# - .Net core将SqlConnection注入(inject)到服务中

c# - MessageBox展开按钮以获取进一步的错误描述

html - 无法将高分辨率图像放入宽度为 33.3333% 的内联 div

html - 嵌套的 div 在 firefox 中不可见,但在 chrome 中可见

html - 如何使 maxlength 属性可访问?

html - 如何垂直对齐div内的表格

php - 如何构建此代码片段以存储 MySQL 中列 "publicationDate"的日期和时间,同时添加另一列 "editedDate"?

javascript - 根据 Jquery 中的选择选项更改按钮名称 =""和表单操作