How To Get Data From Intranet ? I Want To Get An Access File

If you want to download an MDB file you cant update it online, it would be read only as you would have to download a copy and then use it from a temp/semi perminant location.

Take a look at the indy components, they are the easiest to use.

Wher can i find the examples. i hav search thru internet and didn't found it for my prob yet


--Thk for your Advice

They come with indy..

i have tried many ways, but it didn't work.
Here is mine :

var ts : TFileStream;
begin
ts := TFileStream.Create('C:\app.mdb', fmCreate or fmShareDenyNone);
idhttp1.Request.Username := 'manna.legend';
idhttp1.Request.Password := 'hanayou';
idhttp1.Connect;
idhttp1.Get('http://game.won.com/person/nana_ko/shared%20documents/Game.mdb',ts);
end;

this program will create the file in 'C:\' and raise an error : 401 Unauthorized
But when i tried manually, opened the IE, input id and password, its authorized

Could you tell me how ?


--thkz--

You dont appear to have told it to use the basic authentification.

IdHTTP1.Request.BasicAuthentication := true;

Assuming its popping up with a standard html login dialog box, not some web based login.

Hi Lizr,


There's no BasicAuthentication in syntax.
Could you give me the code to download a copy file from there?

--ThkZ:) --

Try your current code on a non password protected file and it should work.

PS now Im home, My indy has the property I listed. Please check again

mmm,, i still can't find the property. But, i got my problem solved when i tried this code :

function DownloadFile(SourceFile, DestFile: string): Boolean;
begin
try
Result := UrlDownloadToFile(nil, PChar(SourceFile), PChar(DestFile), 0, nil) = 0;
except
Result := False;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
const
SourceFile = '\\anime-manga.anime.com\personal\misro\' +
'Shared%20Documents\BasisData.pdf';
DestFile = 'c:\BasisData.pdf';
begin
if DownloadFile(SourceFile, DestFile) then
begin
ShowMessage('Download succesful!');
ShellExecute(Application.Handle, PChar('open'), PChar(DestFile),
PChar(''), nil, SW_NORMAL)
end
else
ShowMessage('Error while downloading ' + SourceFile);
end;

P.S :
1. Don use http, it will raised an error
2. Don use / or //, it will raised an error


THANKS TO GOD and to you, LizR ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.