Discussion:
WinInet : OpenRequest and POST problem
(too old to reply)
Pat
2005-02-10 17:02:38 UTC
Permalink
Hi,
i have been looking the whole day on many newsgroups to find the
solution of my problem but with no luck :(. Many subjects about it but
no real response..
So perhaps someone can light my way for this one.
I know and have read 10x the "How to simulate a Form POST request by
using WinInet" and I am sure that my code is almost like the example
one
But after posting the request to the ASP page i never get the
parameters passed :(. I have read somewhere that it s an encoding
problem but how to solve it when my code is so simple :(

CString sASP=_T("create.asp");
CInternetSession session(_T("My Sessions"));
CHttpConnection * pServer=session.GetHttpConnection("localhost",(INTERNET_PORT)80);
CHttpFile* pFile=pServer->OpenRequest("POST",sASP,NULL,1,NULL,NULL,INTERNET_FLAG_RELOAD);
CString sHeader=_T("Content-Type: application/x-www-form-urlencoded");
CString sData=_T("data=1");
pFile->SendRequest(sHeader,(LPVOID)(LPCTSTR)sData,sData.GetLenght());

create.asp:
<%
dim data
data=request.QueryString("data")
%>
Data = <%=data%>

My Result :
Data =
=>I get back no value :(
Could it be more simple :( ?
Please help..
Thanks in advance...
Stephen Sulzer
2005-02-10 22:16:38 UTC
Permalink
In your ASP code, use Request.Form not Request.QueryString.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/ef3a75f3-aaff-4f0e-b52f-3206c0886476.asp

- Stephen

Loading...