sourcehoh

sourcehoh

  • NA
  • 18
  • 0

Request.Form.AllKeys is empty

Apr 24 2007 3:20 AM

I am developing a page which will accept a post request from other webpages ( php page, asp page ).

I encountered a problem where I couldn't get the Request items during the Page_load event.

Here is my sample page ( htm page )

===== PostPage.htm ==========================

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head>

<title>Untitled Page</title>

</head>

<body>

<form id="frmTestPost" action ="Default.aspx" method ="post">

<div>

<input id="Text1" type="text" /><br />

<input id="Text2" type="text" /><br />

<input id="Hidden1" type="hidden" value = "xxxx" /><br />

<br />

<input id="Submit1" type="submit" value="submit" /></div>

</form>

</body>

</html>

=============================================================

When user click on the Submit button, it will post to an asp.net page ( asp.net 2 ) named Default.aspx

Here is the Page_Load source

=============================

protected void Page_Load(object sender, EventArgs e)
{
string[] strParam = Request.Form.AllKeys; // Alway empty
System.Diagnostics.Debug.WriteLine(strParam.Length);
}

================================

But, I alway getting an empty collection in the Request object. ( It is working fine in Asp 1.1 )

Could anyone give me a helping hand?

Thanks