Thanks Howard,
After I had posted my reply the rest of your message exchange with Remy came
through (one day later - I really dislike Windows Live Mail).
I had just recently been playing around with a TWebbrowser component and I'm
working on using it to work with Javascript code when I discovered the
problem with the Javascript "GET" command gets the cached data whereas
"POST" will get the new data. This also, from my understanding, is related
to IE not working as other browsers do.
Sounds like you've got a handle on the issue.
Patrick Hughes
"howard manwaring" wrote in message news:✉forums.embarcadero.com...
> {quote:title=Patrick Hughes wrote:}{quote}
> Howard,
>
> Does the submit button click initiate a javascript call that uses a "GET"
> function?
>
> If so it may be returning to a page that was cached after entering a bad
> password. I ran into that scenario the other day and substituted a POST
> which fixed the problem.
>
> On a side note I'm curious how you are uploading your grade data as I'm in
> the process of trying to figure out how I need to do it.
>
>
> Patrick Hughes
I honestly don't know about the submit button. That particular button runs a
routine that does nothing except return the results of another routine or
log an error and that calls several other routines that simply return the
result of other routines or log errors which... eventually I think, runs
validation on the user name and password and instructs another bit of code
to run asp (I think) to let you in. My problem turned out to be changes made
in the settings of Internet Explorer. I didn't realise Tweb
browser was, as Remy put it, just a thin wrapper around IE. In IE cookies
had been turned off and also saving of encrypted files had become unchecked.
The cookies prevented me from logging in and the encrypted file setting
prevented me downloading a file from the site as it was being sent via aspx.
I'm not uploading any grade data. I simply log on to the site, navigate to
some pages and initiate the download of some files in exactly the same way
as I could do manually if I were to log on to the site manually.
I may investigate using Indy (TidHTTP) instead of Twebbrowser as I have
already used Indy before to download files elsewhere. All I would need to do
is get it to log in as well as I don't need all the sophistication of a
browser. I used Twebbrowser partly as it is is bit more intuative than Indy
and partly so I had a visual indication of what was happening. In the real
app the browser window is tiny and hidden off the edge of the form.
In case it helps here is how I download a file using Indy. This is a
formless project that downloads a executable (one of mine, called hello.exe)
from a web site and runs it
Because of issues with downloading executables I stored the file on the web
site with an extension of .upd but after downloading I save it with the
extension .exe before I run it. I did this as I was playing around with a
means to make my apps auto-updating. That was before I discovered TWebUpdate
which does it all for me!
Howard
{code}
program Project1;
uses
Forms, ShellApi , windows,
dialogs,
classes, sysutils,
IdHTTP; //an indy componenet
{$R *.res}
var filestream : TFileStream; HTTP: TIdHTTP;
begin
Application.Initialize;
try
http:= TIdHTTP.create; //make an http component
//fool the web site into thinking its firefox doing the call
http.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
5.1)';
//create a new file stream ready to save as an exe with the name hello.exe
filestream := TFileStream.Create (ExtractFilePath(Application.ExeName) +
'hello.exe', fmCreate);
try
// download the file, called hello.upd on the web site, and save via the
filestream
Http.Get('http://www.TheWeSiteName.co.uk/hello.upd', filestream);
except
on e:Exception do
begin
ShowMessage(E.ClassName+' error raised, with message : '+E.Message);
showmessage('could not download file');
end;
end;
finally
filestream.Free;
http.Free;
end;
//run the program we just downloaded
ShellExecute(0, 'open', PChar(ExtractFilePath(Application.ExeName) +
'hello.exe'), nil, nil, SW_SHOWNORMAL);
end.
{code}