Here is the posting page:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Properties login</title>
</head>
<body>
<form id="formstart" method="POST" action="proplist.aspx">
<table id="loginTable" class="center">
<tr>
<td><label >User name</label></td>
<td><input type="text" name="usertext" text="asm"/></td>
</tr>
<tr>
<td><label ID="passwd" >Password</label></td>
<td><input type="text" name="passtext" text=""/></td>
</tr>
<tr>
<td><label ID="Label2" >Press to continue</label></td>
<td><input type="submit" value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>
Simple html, no asp in case that causes any problem. Here is the target aspx page:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="proplist.aspx.cs" Inherits="PropertyW.proplist" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="formlist" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Names="Comic Sans MS" Font-Size="Larger" ForeColor="#3333CC" Text="Property List"></asp:Label>
<div id="loginResponse" runat="server" >not logged in
</div>
<div id="namePassed" runat="server"></div>
</form>
</body>
</html>
Here is the code behind.
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace PropertyW
{
public partial class proplist : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
NameValueCollection nvc = Request.Form;
string userName = "asm", password = "17kgrovE";
string sName = Request.Form["usertext"];
string sPass = nvc["passtext"];
if (nvc.Count > 0)
{
sName = nvc["usertext"] + ".nvc";
}
string sMsg = string.Format("name passed = {0}, nvc count = {1}", sName, nvc.Count);
namePassed.InnerHtml = sMsg;
if (!string.IsNullOrEmpty(sName))
{
userName = sName;
}
if (!string.IsNullOrEmpty(sPass))
{
password = sPass;
}
// CheckLogin(userName, password);
}
}
}
}
Here is what chrome shows in the network tab. There is no entry for the Form data. In the code behind the form fields are null. (usertext and passtext). Chrome shows the request as a GET even though the code is a POST.
Here is what chrome shows in the network tab.
Aucun commentaire:
Enregistrer un commentaire