Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

POST METHOD

Status
Not open for further replies.

naserg

Programmer
Mar 28, 2002
18
0
0
CA
I have problems with method POST when I use IIS 5.1 + IE 6.x on Windows XP professional.
When I use method GET that's OK.

For example:
Page HTML:
<form name=&quot;frm&quot; action=&quot;results.asp&quot; method=&quot;post&quot;>
<P>Login: <input type=&quot;text&quot; name=&quot;login&quot; size=&quot;15&quot; value=&quot;mylogin&quot;>
<P><input type=&quot;submit&quot; value=&quot;GO&quot;>
</form>

Page results.asp:
<%
Dim login
login = request.form(&quot;login&quot;);
%>
LOGIN = <%=login%>

Result:
1) Method Post:
LOGIN = Bad
2) Method Get:
LOGIN = mylogin OK

What's the problem with POST method?When I get the server variable REQUEST_METHOD it always returns as GET, No matter what I used in my form.

Many thanks in advance for responses.

Naser
 
try:

Dim login
login = request.QueryString(&quot;login&quot;)

or

login = request(&quot;login&quot;)
&quot;did you just say Minkey?, yes that's what I said.&quot;

MrGreed
 
Thanks MrGreed for responding. I tried it but didn't work.
The problem is Why server returns the server variable request_method as GET while I am using the POST method.
I tried:
Dim Method
Method = Request.ServerVariables(&quot;request_method&quot;)
Response.Write (&quot;Request Method =&quot; & Method)

and the result is:
Request Method =GET

It should be POST but I don't know why server returns GET no matter what I use in my form. any idea?
Thanks
Naser
 
naserg,

When your METHOD=&quot;POST&quot;, on the receiving ASP page, use request.form(&quot;myvariable&quot;).

When your METHOD=&quot;GET&quot;, on the receiving ASP page, use request.querystring(&quot;myvariable&quot;).

fengshui_1998

 
FengShui1998
Thank you for your response.I know that I should use
request.querystring(&quot;myvariable&quot;) and
request.form(&quot;myvariable&quot;) with GET and POST respectivly.
The problem is I can't get the POST method to work and my server does non recognize my form with post method and returns GET no matter what I use in my form.As I said before it returns GET for
Request.ServerVariables(&quot;request_method&quot;) while I am using POST in my form.any idea?
 
naserg,

Can you show your html code? Do you have any INCLUDES, etc...?


fengshui_1998
 
FengShui1998 Thank you for response.

My html file is:

<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
<TITLE>Title</TITLE>
</HEAD>
<BODY>
<form name=&quot;frm&quot; id=&quot;frm&quot; action=&quot;results2.asp&quot; method=&quot;post&quot;>
Login:
<input type=&quot;text&quot; name=&quot;login&quot; id=&quot;login&quot; value=&quot;mylogin&quot;><BR><BR>  
<input type=&quot;submit&quot; value=&quot;GO&quot;>  
</form>
</BODY>
</HTML>

and my asp file is:

<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
<%
Dim login
Dim Method
Method = Request.ServerVariables(&quot;request_method&quot;)
Response.Write (&quot;Request Method =&quot; & Method &&quot;<BR>&quot;)
login = Request.Form(&quot;login&quot;)
Response.Write(&quot;LOGIN = &quot; & login)
%>
</HEAD>
<BODY>
<p></p>
</BODY>
</HTML>

and result is:

Request Method =GET
LOGIN =

As you see it is very simple and I don't have any INCLUDES, etc...

There should be some thing wrong with my IIS5.1 congiguration.

Regards,
 
Just as a matter of interest, does the address bar show the parameters in the querystring like it should with GET?
 
Hi HellTel
When I use the POST method address bar does not show the parameter and bahaves like POST. Something new that I saw in the log file is following :
21:19:24 127.0.0.1 GET /post.htm 206
21:19:27 127.0.0.1 POST /results2.asp 200
21:19:27 127.0.0.1 GET /results2.asp 200
It seems the server first accept the POST method but I don't know why it changes the method to GET again.
Seems to me the asp page refreshes automatically.
 
naserg,

I copied your contents into two files and this was the result on the web page. It works as it should.

The only thing I can think of is in Internet Services Manager, highlight your web site, right click to properties,
go to Home DIrectory tab, click configuration and see what .ASP tells you.

fengshui_1998


Request Method =POST
LOGIN = mylogin
 
FengShui1998 Thanks again. This is what I found under configuration for .asp file:

Exacutable C:\WINDOWS\System32\inetsrv\asp.dll
Extention .asp
verbs
limit to: GET,HEAD,POST,TRACE
 
try this(for post method):

in your asp page:

dim login1

login1 = request(&quot;login&quot;)

 
Hi SHimo
I tried it but have the same problem. When I use GET method your code works but when I change it to POST does not.
 
I noticed that when I keep the ENTER and then click on the submit button it works and the result is:
Request Method =POST
LOGIN = mylogin
But without keeping the ENTER down the result is:
Request Method =GET
LOGIN =
I think there should be something wrong with the cache in IIS.
Help please!!!!!!!!



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top