473,390 Members | 1,131 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

open "filename.txt" for input not working

I'm working on migrating an Classic ASP/VB6 COM application from an NT
Server with IIS<6 to an virtual machine running Windows Server 2003 and
IIS 6. I've worked through most of the obvious problems resulting from
IIS 6 prohibiting ASP and SSI etc, but I've hit a peculiar wall.

One ASP page uses a VB6 COM object that basically reads from an .INI
file and uses it to open another file. The existing code uses this line
(in VB6) to do this:

Open "UpLoad.ini" For Input As #1

This works fine in the existing setup, but on the new box it returns a
"File Not Found" error at this line. If I hard code a path in there
(i.e. "C:\temp\Upload.ini") it will work, but I don't want to do that.
So my question is, why isn't this working? It should be trying to read
UpLoad.ini from the same directory that the .dll file is registered in,
right? (in this case, C:\WINDOWS\System32) Is it a permissions issue?
I've tried giving IUSR_* and SYSTEM accounts read/write access to that
folder (against my better judgement) as well as to the folder the code
is ultimately going to write to (that's a whole other, but perhaps
similar, ball of wax).

So does this ring bells for anyone? Any help would be greatly appreciated.

-Seth
Apr 15 '06 #1
8 2466
Try Server.MapPath() 'ing the file .......

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Seth Darr" <se**@sethmo.com> wrote in message
news:Nae0g.4502$ZW3.1569@dukeread04...
I'm working on migrating an Classic ASP/VB6 COM application from an NT
Server with IIS<6 to an virtual machine running Windows Server 2003 and
IIS 6. I've worked through most of the obvious problems resulting from
IIS 6 prohibiting ASP and SSI etc, but I've hit a peculiar wall.

One ASP page uses a VB6 COM object that basically reads from an .INI
file and uses it to open another file. The existing code uses this line
(in VB6) to do this:

Open "UpLoad.ini" For Input As #1

This works fine in the existing setup, but on the new box it returns a
"File Not Found" error at this line. If I hard code a path in there
(i.e. "C:\temp\Upload.ini") it will work, but I don't want to do that.
So my question is, why isn't this working? It should be trying to read
UpLoad.ini from the same directory that the .dll file is registered in,
right? (in this case, C:\WINDOWS\System32) Is it a permissions issue?
I've tried giving IUSR_* and SYSTEM accounts read/write access to that
folder (against my better judgement) as well as to the folder the code
is ultimately going to write to (that's a whole other, but perhaps
similar, ball of wax).

So does this ring bells for anyone? Any help would be greatly appreciated.

-Seth

Apr 16 '06 #2
Server.MapPath is only giving me the physical path of the ASP page. The path
of the ActiveX component and the path that Open...For Input is independent of
this. If I knew of an equivalent Server.MapPath function for opening files
for input in VB6, I might get somewhere. But so far that has eluded me.

"Steven Burn" wrote:
Try Server.MapPath() 'ing the file .......

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Seth Darr" <se**@sethmo.com> wrote in message
news:Nae0g.4502$ZW3.1569@dukeread04...
I'm working on migrating an Classic ASP/VB6 COM application from an NT
Server with IIS<6 to an virtual machine running Windows Server 2003 and
IIS 6. I've worked through most of the obvious problems resulting from
IIS 6 prohibiting ASP and SSI etc, but I've hit a peculiar wall.

One ASP page uses a VB6 COM object that basically reads from an .INI
file and uses it to open another file. The existing code uses this line
(in VB6) to do this:

Open "UpLoad.ini" For Input As #1

This works fine in the existing setup, but on the new box it returns a
"File Not Found" error at this line. If I hard code a path in there
(i.e. "C:\temp\Upload.ini") it will work, but I don't want to do that.
So my question is, why isn't this working? It should be trying to read
UpLoad.ini from the same directory that the .dll file is registered in,
right? (in this case, C:\WINDOWS\System32) Is it a permissions issue?
I've tried giving IUSR_* and SYSTEM accounts read/write access to that
folder (against my better judgement) as well as to the folder the code
is ultimately going to write to (that's a whole other, but perhaps
similar, ball of wax).

So does this ring bells for anyone? Any help would be greatly appreciated.

-Seth


Apr 17 '06 #3
Can't you server.mappath before supplying the AX with the name of the file?
(i.e. pass the whole path)

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Seth Darr" <Se******@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com...
Server.MapPath is only giving me the physical path of the ASP page. The path of the ActiveX component and the path that Open...For Input is independent of this. If I knew of an equivalent Server.MapPath function for opening files for input in VB6, I might get somewhere. But so far that has eluded me.

"Steven Burn" wrote:
Try Server.MapPath() 'ing the file .......

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Seth Darr" <se**@sethmo.com> wrote in message
news:Nae0g.4502$ZW3.1569@dukeread04...
I'm working on migrating an Classic ASP/VB6 COM application from an NT
Server with IIS<6 to an virtual machine running Windows Server 2003 and IIS 6. I've worked through most of the obvious problems resulting from
IIS 6 prohibiting ASP and SSI etc, but I've hit a peculiar wall.

One ASP page uses a VB6 COM object that basically reads from an .INI
file and uses it to open another file. The existing code uses this line (in VB6) to do this:

Open "UpLoad.ini" For Input As #1

This works fine in the existing setup, but on the new box it returns a
"File Not Found" error at this line. If I hard code a path in there
(i.e. "C:\temp\Upload.ini") it will work, but I don't want to do that.
So my question is, why isn't this working? It should be trying to read
UpLoad.ini from the same directory that the .dll file is registered in, right? (in this case, C:\WINDOWS\System32) Is it a permissions issue?
I've tried giving IUSR_* and SYSTEM accounts read/write access to that
folder (against my better judgement) as well as to the folder the code
is ultimately going to write to (that's a whole other, but perhaps
similar, ball of wax).

So does this ring bells for anyone? Any help would be greatly appreciated.
-Seth


Apr 17 '06 #4
Not really, the .ini's location is entirely independent of the web
file/folder structure. I could modify the asp page to send in a path to
the AX like you're suggesting (i.e. send in
"C:\WINDOWS\system32\upload.ini") but the whole point of this migration
is to have a personal copy of the production environment in work
(unfortunately, the vm setup they gave me is more modern than the
production environment). I can't just modify the production environment
to match my setup without submitting reams of action plans and service
requests etc and then I'm not so sure it's a compelling enough reason
for them. Catch my meaning?

So I guess what I'm looking for here is not so much an alternative
solution/workaround in CODE as an EXPLANATION of this discrepancy and,
hopefully, a workaround in my SYSTEM to rectify the discrepancy (i.e.
IIS settings, server settings, etc)
Steven Burn wrote:
Can't you server.mappath before supplying the AX with the name of the file?
(i.e. pass the whole path)

Apr 18 '06 #5
The reason it's happening is that whilst the .dll and .ini file are in the
same folder, the .dll is being instantiated from a completely different
folder and thus, you need to tell it where to find the .ini file.
--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Seth Darr" <se**@sethmo.com> wrote in message
news:KzX0g.4729$ZW3.652@dukeread04...
Not really, the .ini's location is entirely independent of the web
file/folder structure. I could modify the asp page to send in a path to
the AX like you're suggesting (i.e. send in
"C:\WINDOWS\system32\upload.ini") but the whole point of this migration
is to have a personal copy of the production environment in work
(unfortunately, the vm setup they gave me is more modern than the
production environment). I can't just modify the production environment
to match my setup without submitting reams of action plans and service
requests etc and then I'm not so sure it's a compelling enough reason
for them. Catch my meaning?

So I guess what I'm looking for here is not so much an alternative
solution/workaround in CODE as an EXPLANATION of this discrepancy and,
hopefully, a workaround in my SYSTEM to rectify the discrepancy (i.e.
IIS settings, server settings, etc)
Steven Burn wrote:
Can't you server.mappath before supplying the AX with the name of the file? (i.e. pass the whole path)

Apr 18 '06 #6
At the risk of sounding like a broken record... why why why? Why does it
suffice to specify the relative path from the executable in one environment
and not the other? How do you find out where its being instantiated and
subsequently control it (not through code, but system settings)? Why do hot
dogs come in packs of 10 while hot dog buns come in packs of 12? etc.

"Steven Burn" wrote:
The reason it's happening is that whilst the .dll and .ini file are in the
same folder, the .dll is being instantiated from a completely different
folder and thus, you need to tell it where to find the .ini file.
--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Seth Darr" <se**@sethmo.com> wrote in message
news:KzX0g.4729$ZW3.652@dukeread04...
Not really, the .ini's location is entirely independent of the web
file/folder structure. I could modify the asp page to send in a path to
the AX like you're suggesting (i.e. send in
"C:\WINDOWS\system32\upload.ini") but the whole point of this migration
is to have a personal copy of the production environment in work
(unfortunately, the vm setup they gave me is more modern than the
production environment). I can't just modify the production environment
to match my setup without submitting reams of action plans and service
requests etc and then I'm not so sure it's a compelling enough reason
for them. Catch my meaning?

So I guess what I'm looking for here is not so much an alternative
solution/workaround in CODE as an EXPLANATION of this discrepancy and,
hopefully, a workaround in my SYSTEM to rectify the discrepancy (i.e.
IIS settings, server settings, etc)
Steven Burn wrote:
Can't you server.mappath before supplying the AX with the name of the file? (i.e. pass the whole path)


Apr 18 '06 #7
So you always have to buy more buns ;o)
At the risk of sounding like a broken record... why why why? Why does it
suffice to specify the relative path from the executable in one environment and not the other?
Because it's a different environment? (unless the envir's are the same, the
behaviour is rarely going to be same).
How do you find out where its being instantiated and
subsequently control it (not through code, but system settings)?
Unless it is explicitly told otherwise, it's always being instantiated in
the dir in which it is called (in this case, the dir of your script).

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Seth Darr" <Se******@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com... At the risk of sounding like a broken record... why why why? Why does it
suffice to specify the relative path from the executable in one environment and not the other? How do you find out where its being instantiated and
subsequently control it (not through code, but system settings)? Why do hot dogs come in packs of 10 while hot dog buns come in packs of 12? etc.

"Steven Burn" wrote:
The reason it's happening is that whilst the .dll and .ini file are in the same folder, the .dll is being instantiated from a completely different
folder and thus, you need to tell it where to find the .ini file.
--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Seth Darr" <se**@sethmo.com> wrote in message
news:KzX0g.4729$ZW3.652@dukeread04...
Not really, the .ini's location is entirely independent of the web
file/folder structure. I could modify the asp page to send in a path to the AX like you're suggesting (i.e. send in
"C:\WINDOWS\system32\upload.ini") but the whole point of this migration is to have a personal copy of the production environment in work
(unfortunately, the vm setup they gave me is more modern than the
production environment). I can't just modify the production environment to match my setup without submitting reams of action plans and service
requests etc and then I'm not so sure it's a compelling enough reason
for them. Catch my meaning?

So I guess what I'm looking for here is not so much an alternative
solution/workaround in CODE as an EXPLANATION of this discrepancy and,
hopefully, a workaround in my SYSTEM to rectify the discrepancy (i.e.
IIS settings, server settings, etc)
Steven Burn wrote:
> Can't you server.mappath before supplying the AX with the name of
the file?
> (i.e. pass the whole path)
>


Apr 18 '06 #8
I finally stumbled upon the solution that I was looking for on this: running
the www service in IIS 5.0 Isolation mode
(http://www.microsoft.com/technet/pro....mspx?mfr=true)

From the article:
"You must use IIS 5.0 isolation mode for applications that conflict with
worker process isolation mode until the applications are modified.

The following application characteristics conflict with worker process
isolation mode:

[...]

• Requires Dllhost.exe: Applications that must be run in a Dllhost.exe
environment can be run only in IIS 5.0 isolation mode because Dllhost.exe is
not available in worker process isolation mode."

In other word, ActiveX dlls. Works like a champ now. Maybe now the dreams
will stop.

Thanks, though, Steven, for your help.

-Seth
"Steven Burn" wrote:
So you always have to buy more buns ;o)
At the risk of sounding like a broken record... why why why? Why does it
suffice to specify the relative path from the executable in one

environment
and not the other?


Because it's a different environment? (unless the envir's are the same, the
behaviour is rarely going to be same).
How do you find out where its being instantiated and
subsequently control it (not through code, but system settings)?


Unless it is explicitly told otherwise, it's always being instantiated in
the dir in which it is called (in this case, the dir of your script).

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Seth Darr" <Se******@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...
At the risk of sounding like a broken record... why why why? Why does it
suffice to specify the relative path from the executable in one

environment
and not the other? How do you find out where its being instantiated and
subsequently control it (not through code, but system settings)? Why do

hot
dogs come in packs of 10 while hot dog buns come in packs of 12? etc.

"Steven Burn" wrote:
The reason it's happening is that whilst the .dll and .ini file are in the same folder, the .dll is being instantiated from a completely different
folder and thus, you need to tell it where to find the .ini file.
--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Seth Darr" <se**@sethmo.com> wrote in message
news:KzX0g.4729$ZW3.652@dukeread04...
> Not really, the .ini's location is entirely independent of the web
> file/folder structure. I could modify the asp page to send in a path to > the AX like you're suggesting (i.e. send in
> "C:\WINDOWS\system32\upload.ini") but the whole point of this migration > is to have a personal copy of the production environment in work
> (unfortunately, the vm setup they gave me is more modern than the
> production environment). I can't just modify the production environment > to match my setup without submitting reams of action plans and service
> requests etc and then I'm not so sure it's a compelling enough reason
> for them. Catch my meaning?
>
> So I guess what I'm looking for here is not so much an alternative
> solution/workaround in CODE as an EXPLANATION of this discrepancy and,
> hopefully, a workaround in my SYSTEM to rectify the discrepancy (i.e.
> IIS settings, server settings, etc)
>
>
> Steven Burn wrote:
> > Can't you server.mappath before supplying the AX with the name of the file?
> > (i.e. pass the whole path)
> >


Apr 19 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sameh Abdelatef | last post by:
Dear perl experts, I used to use to open and add new lines to $filename, but it didn't work any more. The perl version is 5.8.1. When I try it's work but the content of $filename is deletd....
1
by: Christopher Reeve | last post by:
Hi, I wonder if anyone could help me. I am moving accross from C to C++ and am writing a program that reads and writes data into a file. I am aware of the old C ways of doing it but am trying to...
4
by: MLH | last post by:
Is it good programming practice to delete existing file before running Open "c:\MyFile.txt" For Output As #1 ??? IE, I already have a file c:\MyFile.txt on disk and I launch Open "c:\MyFile.txt"...
1
by: Ducknut | last post by:
Not so much a problem as a discussion. I am currently in the early stages of designing a database to hold a bunch of water quality data (e.g., concentrations of heavy metals in drinking water). Water...
5
by: John Nagle | last post by:
This bug, " robotparser interactively prompts for username and password", has been open since 2003. It killed a big batch job of ours last night. Module "robotparser" naively uses "urlopen" to...
0
by: Ofelia | last post by:
Hi, I'm new to this forum and to Perl language but I would like to ask for your help. I'm working in Linux and the files I need to process are in the format file.gz. I created a script which...
2
by: John Nagle | last post by:
For some reason, Python's parser for "robots.txt" files doesn't like Wikipedia's "robots.txt" file: False The Wikipedia robots.txt file passes robots.txt validation, and it doesn't disallow...
8
by: Michael Robertson | last post by:
I'm having trouble opening a file in linux, whose path has spaces in it. $ mkdir my\ test $ echo test my\ test/test.txt $ python Exception Exception but yet...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.