CAtlNavigateData can not deal with special symbol such as +
CAtlNavigateData navData;
CStringA m_strForm = "name=+++&priv=1&password=";
navData.SetSocketTimeout(m_nMilliSecond);
navData.SetMethod(ATL_HTTP_METHOD_POST);
navData.SetPostData((BYTE*)(LPSTR)(LPCSTR)m_strForm, m_strForm.开发者_Go百科GetLength(), QHTTP_FORM_URLENCODE);
I catch the posted package, and find post data
name = ""
, it should be name="+++"
. Does SetPostData(...)
can not deal with special symbol. How can I avoid this?
Thanks for Snazzer's answer. Does ATL provides API for doing this?
You need to URL encode your string, so replace the '+' with '%2B'
CStringA m_strForm = "name=%2B%2B%2B&priv=1&password=";
For more information, check out URL encoding
精彩评论