symbian 使用http get post方式获取网页信息
2010-05-31 19:38:00 来源:WEB开发网418. // Called by framework when we requested authenticated page and framework
419. // needs to know username and password.
420. // ----------------------------------------------------------------------------
421. TBool CClientEngine::GetCredentialsL(const TUriC8& aURI,
422. RString aRealm,
423. RStringF aAuthenticationType,
424. RString& aUsername,
425. RString& aPassword)
426. {
427. // aURI, aReal and aAuthenticationType are informational only. We only need
428. // to set aUsername and aPassword and return ETrue, if aUsername and
429. // aPassword are provided by user.
430. // Informational only
431. TBuf< KURIBufferSize > authType;
432. TBuf< KURIBufferSize > uri;
433. TBuf< KDefaultBufferSize > authText;
434. authType.Copy(aAuthenticationType.DesC());
435. uri.Copy(aURI.UriDes());
436. _LIT(KAuthRequired, "%S requires %S authentication.");
437. authText.Format(KAuthRequired, &uri, &authType);
438. _LIT(KAuthNote, "Authentication required.");
439. CEikonEnv::Static()- >InfoWinL(KAuthNote, authText);
440. // Query user name and password
441. TBuf< KDefaultBufferSize > userName;
442. TBuf< KDefaultBufferSize > password;
443. CAknMultiLineDataQueryDialog* dlg =
444. CAknMultiLineDataQueryDialog::NewL(userName, password);
445. if (!dlg- >ExecuteLD(R_DIALOG_USER_PASSWORD_QUERY))
446. return EFalse; // No credentials given; must return EFalse
447. // Set aUsername and aPassword
448. TBuf8< KDefaultBufferSize > temp;
449. temp.Copy(userName);
450. TRAPD(err, aUsername = aRealm.Pool().OpenStringL(temp));
451. if (!err)
更多精彩
赞助商链接