Discussion:
Wininet and htaccess
(too old to reply)
Boulent Mustafa
2004-05-17 12:31:31 UTC
Permalink
I am looking at creating a Windows CE Application in Embedded Visual
C++ that will connect to the internet and retrieve a text file from
the htaccess protected area of our website.

However I need some way of making the application integrate with the
htaccess mechanism.

The idea is that the username and password is entered and it then
becomes part of the URL.

Once this has been achieved the application will load a Flash Movie in
Pocket Internet Explorer, the text file is a data source for the flash
movie.

Any suggestions as to where I am going wrong would be most
appreciated. I have inserted a copy of the function below.

Kind Regards,
Boulent

void Go()
{
int usernamechars = GetDlgItemText(g_hwndDialog, IDC_N, username,
NULL);
int passwordchars = GetDlgItemText(g_hwndDialog, IDC_P, password,
NULL);

// if ((username <= "") || (password <= ""))
// MessageBox(g_hwndDialog, L"Please enter your username and/or
password", L"Input error", MB_ICONSTOP);


LPCTSTR EquinexInternet = _T("Equinex-Internet");
// LPCTSTR HttpPrefix = _T("http://");
// LPCTSTR Colon = _T(":");
// LPCTSTR UrlSuffix = _T("");
// LPCTSTR UrlToOpen =
LPCTSTR UrlToOpen = _T("http://username:***@url/to/open");
HINTERNET NetStatus = InternetOpen(EquinexInternet,
INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, NULL);
HINTERNET OpenUrlStatus = InternetOpenUrl(NetStatus, UrlToOpen, NULL,
NULL, INTERNET_FLAG_DONT_CACHE, NULL);

// BSTR btitleURL =
SysAllocString(TEXT("http://username:***@url/to/open"));
// SendMessage(g_hwndDialog, DTM_NAVIGATE, 0, (LPARAM)btitleURL);
// SysFreeString(btitleURL);

SHELLEXECUTEINFO offlinedata;
ZeroMemory(&offlinedata, sizeof(SHELLEXECUTEINFO));
offlinedata.cbSize = sizeof(SHELLEXECUTEINFO);
offlinedata.lpFile = _T("file:///my documents/webpage.htm");
offlinedata.nShow = SW_SHOW;
ShellExecuteEx(&offlinedata);

BOOL XHCacheEntry;
LPCTSTR XHUrlName =
_T("urltocache");
DWORD XHFileSize = 0;
LPCTSTR XHFileExtension = 0;
LPTSTR XHFileName = 0;;
DWORD XHdwReserved = 0;

// HWND hwButton = GetDlgItem(g_hwndDialog, IDC_BUTTON1);
int nCnt;
TCHAR szBufW[16];
wsprintf(szBufW, L"Button %d", nCnt);
// Button_SetText(hwButton, szBufW);

XHCacheEntry = CreateUrlCacheEntry(XHUrlName, XHFileSize,
XHFileExtension, XHFileName, XHdwReserved);


}
Jussi Jumppanen
2004-05-20 12:13:09 UTC
Permalink
Post by Boulent Mustafa
I am looking at creating a Windows CE Application in Embedded Visual
C++ that will connect to the internet and retrieve a text file from
the htaccess protected area of our website.
However I need some way of making the application integrate with the
htaccess mechanism.
The idea is that the username and password is entered and it then
becomes part of the URL.
Quite some time ago I had to write something similar and at the
time also ran into problems getting it to work. For quite a length
of time I managed to achieve very little.

I finally did manage to solve the problem, but it was only when I
cam up with the idea of setting up a proxy server, which would then
let me sniff the commands being sent to the remote server.

I then used a browser to connect to the serve and compared the trace
log to that produced by my application attempted to connect.

Jussi Jumppanen
Author of: Zeus for Windows (All new version 3.92 out now)
"The C/C++, Cobol, Java, HTML, Python, PHP, Perl programmer's editor"
Home Page: http://www.zeusedit.com

Loading...