My Asp.net aspx page always reports HttpMethod is "GET" even it is "POST" from client, ?

J

Jeff

Visual Studio 2003
DotNet framework 1.1
Windows 2000 Pro

I create two pages in an Asp.net application, one is html page with a form
in it:
....
<form id="testForm" method="post" action="test.aspx" runat="server">
<input type="hidden" id="hiddenTest" value="hello, world">
<input type="submit" id="btnSubmit" value="submit">
</form>
....

Another one page is aspx page. It is a blank aspx page in which Request info
is shown in Page_load even handler:
private void Page_Load(object sender, System.EventArgs e) {

//show Request info

string httpMethod = Request.HttpMethod;

....

If I run this web application from the html page and click the submit
button, the aspx page gets called. But from debugger, the value of
Request.HttpMethod will always be "GET" rather than "Post". ???

Has anyone had this kind of problems before?

Thanks!!!
 
G

garethdjames

You shouldn't post from one apsx page to another,

I know this seems alien if you have come from ASP development but aspx
pages should post back to them selves, let me know if you need any more
info
 
J

Jeff

Yes, would you please suggest me some links to the related documentation
about this designed behavior that I can't use Http POST to send request to
an Aspx page?

Thanks,
 
J

Jeff

The exact same code works on another machine fine, isn't it weird?

HttpMethod is "POST" on that machine when the aspx page gets the request
from the Html page. ??? What is wrong with my machine!! grrrrrrrr.........
 
J

Joerg Jooss

Jeff said:
Yes, would you please suggest me some links to the related
documentation about this designed behavior that I can't use Http POST
to send request to an Aspx page?

Of course you can and you should (most of the time). What Gareth meant
to say is that in the ASP.NET model a page only sends requests to
itself, not to another page. Navigation is either performed by
Hyperlinks, Server.Transfer() or Response.Redirect().


Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,809
Latest member
moe77

Latest Threads

Top