BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Ini Files

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Thirdparty Tools (IntraWeb)
View previous topic :: View next topic  
Author Message
Shane Holmes
Guest





PostPosted: Tue Apr 10, 2007 6:24 pm    Post subject: Ini Files Reply with quote



Is it possible to use an INI file with Intraweb?

I have created an Intraweb ISAPI DLL. I am trying to read an INI file that
resides on the server side with the DLL. I tried placing the Ini File in the
public folder and I have tried placing it elsewhere and I can't seem to read
it from anywhere.

I created a Files folder under the Public folder and

procedure TIWServerController.IWServerControllerBaseCreate(
Sender: TObject);
begin
FilesDir:= AppPath + 'Files\';
end;

here is my IniFiles creation code

procedure TIWUserSession.IWUserSessionBaseCreate(Sender: TObject);
begin
if FileExists('ValuPort.ini') then
begin
IniFile:= TInIFile.Create('ValuPort.ini');
try
//do database connection stuff here
finally
IniFile.Free;
end;
end;
end;

there is no path in from of the "ValuPort.ini" - but believe me, I have
tried numerous things

GetModulePath
WebApplication.ApplicationPath
WebApplication.AppURLBase


I can't use the direct path - "C:\Program Files\.....
on my machine, because it will be different on others machines.

I Do not use MS IIS. I use a personal custom made HTTP Server


THanks!

S
Back to top
Shane Holmes
Guest





PostPosted: Tue Apr 10, 2007 6:37 pm    Post subject: Re: Ini Files Reply with quote



I have even tried this

if FileExists(IWServerController.AppPath + 'ValuPort.ini') then

Thanks

"Shane Holmes" <holmesshanea @ yahoo . com> wrote in message
news:461b9003$1 (AT) newsgroups (DOT) borland.com...
Quote:
Is it possible to use an INI file with Intraweb?

I have created an Intraweb ISAPI DLL. I am trying to read an INI file
that resides on the server side with the DLL. I tried placing the Ini File
in the public folder and I have tried placing it elsewhere and I can't
seem to read it from anywhere.

I created a Files folder under the Public folder and

procedure TIWServerController.IWServerControllerBaseCreate(
Sender: TObject);
begin
FilesDir:= AppPath + 'Files\';
end;

here is my IniFiles creation code

procedure TIWUserSession.IWUserSessionBaseCreate(Sender: TObject);
begin
if FileExists('ValuPort.ini') then
begin
IniFile:= TInIFile.Create('ValuPort.ini');
try
//do database connection stuff here
finally
IniFile.Free;
end;
end;
end;

there is no path in from of the "ValuPort.ini" - but believe me, I have
tried numerous things

GetModulePath
WebApplication.ApplicationPath
WebApplication.AppURLBase


I can't use the direct path - "C:\Program Files\.....
on my machine, because it will be different on others machines.

I Do not use MS IIS. I use a personal custom made HTTP Server


THanks!

S
Back to top
Shane Holmes
Guest





PostPosted: Tue Apr 10, 2007 7:32 pm    Post subject: Re: Ini Files Reply with quote



This was answered in another group...by Stefan Van As

See answer below:

If you don't provide a directory, TIniFile is going to look in the "current
directory" (not necessarily your AppPath + 'Files' directory).

My advice would be to retrieve your DLL's directory, and then concat
'\Files\ValuPort.ini'

You can use the following functions:

function TIWServerController.GetModuleFileName: string;
var
S: array[0..MAX_PATH] of Char;
begin
Windows.GetModuleFileName(hInstance, S, SizeOf(S));
Result := S;

// on Windows 2003, the result may have the "\\?\" prefix (this is
supposed to
// turn off path parsing).
//
// "\\?\" itself is supposed to be ignored as part of the path. For
example:
// 1) "\\?\C:\myworld\private" is seen as...
"C:\myworld\private", and
// 2) "\\?\UNC\bill_g_1\hotstuff\coolapps" is seen as...
"\\bill_g_1\hotstuff\coolapps"
//
// However, TIniFile doesn't seem to support this, and raises an
exception. Here
// we try and "fix" this issue...

if (Length(Result) > 3) and (Copy(Result, 1, 4) = '\\?\') then
Delete(Result, 1, 4);
end;

function TIWServerController.GetIniFile: string;
begin
Result := ExtractFileDir(GetModuleFileName) + '\Files\ValuPort.ini');
end;

Stefan.




"Shane Holmes" <holmesshanea @ yahoo . com> wrote in message
news:461b92e5 (AT) newsgroups (DOT) borland.com...
Quote:
I have even tried this

if FileExists(IWServerController.AppPath + 'ValuPort.ini') then

Thanks

"Shane Holmes" <holmesshanea @ yahoo . com> wrote in message
news:461b9003$1 (AT) newsgroups (DOT) borland.com...
Is it possible to use an INI file with Intraweb?

I have created an Intraweb ISAPI DLL. I am trying to read an INI file
that resides on the server side with the DLL. I tried placing the Ini
File in the public folder and I have tried placing it elsewhere and I
can't seem to read it from anywhere.

I created a Files folder under the Public folder and

procedure TIWServerController.IWServerControllerBaseCreate(
Sender: TObject);
begin
FilesDir:= AppPath + 'Files\';
end;

here is my IniFiles creation code

procedure TIWUserSession.IWUserSessionBaseCreate(Sender: TObject);
begin
if FileExists('ValuPort.ini') then
begin
IniFile:= TInIFile.Create('ValuPort.ini');
try
//do database connection stuff here
finally
IniFile.Free;
end;
end;
end;

there is no path in from of the "ValuPort.ini" - but believe me, I have
tried numerous things

GetModulePath
WebApplication.ApplicationPath
WebApplication.AppURLBase


I can't use the direct path - "C:\Program Files\.....
on my machine, because it will be different on others machines.

I Do not use MS IIS. I use a personal custom made HTTP Server


THanks!

S


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Thirdparty Tools (IntraWeb) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.