+ -
当前位置:首页 → 问答吧 → POST登录方式的问题

POST登录方式的问题

时间:2011-12-10

来源:互联网

亲们,我的asp表单是这样的:

<form method="post" action="checkuser.asp">
学号<input type=text name="username" value=admin>
密码<input type=password name="pwd" value=admin>
学生<input type=radio name="tp" value="学生" checked>
<input name="method" value="login">
<input type=submit>
</form>

我保存为html点击提交时可以登录

但是
MFC里登录时,我用如下方法
pHttpConnection = Session.GetHttpConnection("我的IP地址");
CString headers = _T("Content-Type: application/x-www-form-urlencoded");
CString data="?username=admin&pwd=admin&tp=学生&method=login";
pHTTP = pHttpConnection->OpenRequest("POST", "/checkuser.asp");
pHTTP->SendRequest(headers,headers.GetLength(),(LPVOID)(LPCTSTR)data,data.GetLength());

总是无法登录。
这是为什么呢?
谢谢。

作者: Danny_Share   发布时间: 2011-12-10

CString data="?username=admin&pwd=admin&tp=学生&method=login";
去掉第一个?,并且对“学生”进行URL_encode

CString data="username=admin&pwd=admin&tp="+URL_encode
("学生")+"&method=login";

作者: ok1234567   发布时间: 2011-12-11

热门下载

更多