473,809 Members | 2,757 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

open "filename.t xt" 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\Syst em32) 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 2491
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.co m> wrote in message
news:Nae0g.4502 $ZW3.1569@duker ead04...
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\Syst em32) 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.co m> wrote in message
news:Nae0g.4502 $ZW3.1569@duker ead04...
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\Syst em32) 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******@discu ssions.microsof t.com> wrote in message
news:9F******** *************** ***********@mic rosoft.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.co m> wrote in message
news:Nae0g.4502 $ZW3.1569@duker ead04...
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\Syst em32) 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\sys tem32\upload.in i") 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.co m> wrote in message
news:KzX0g.4729 $ZW3.652@dukere ad04...
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\sys tem32\upload.in i") 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.co m> wrote in message
news:KzX0g.4729 $ZW3.652@dukere ad04...
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\sys tem32\upload.in i") 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******@discu ssions.microsof t.com> wrote in message
news:4E******** *************** ***********@mic rosoft.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.co m> wrote in message
news:KzX0g.4729 $ZW3.652@dukere ad04...
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\sys tem32\upload.in i") 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******@discu ssions.microsof t.com> wrote in message
news:4E******** *************** ***********@mic rosoft.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.co m> wrote in message
news:KzX0g.4729 $ZW3.652@dukere ad04...
> 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\sys tem32\upload.in i") 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
1522
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. Any help will be appreciated.
1
4010
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 use the C++ functions which don't seem to be working propperly. I need to open the file for reading and writing because I want to search for a possition in a file called settings.dat and then write a number after a certain chatacter. However when...
4
9170
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" For Output As #1 ==> VBA is supposed to overwrite whatever WAS there with the new contents - right? And if that is true, does it matter whether I delete the existing file prior to running the Open statement?
1
1801
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 samples will be sent to a lab for analysis and the lab will send back a report (usually in excel or .txt format), that data will be imported into Access. If the concentration of a heavy metal is lower than the detectable limit of the analysis, the...
5
1944
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 read "robots.txt" URLs. If the server asks for basic authentication on that file, "robotparser" prompts for the password on standard input. Which is rarely what you want. You can demonstrate this with: import robotparser
0
2676
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 should decompress, open and then delete nearly 400 files. To do so I use "open FILEPT, "zcat $filename|"". In the beginning the script works fine, but after about 300 files processed I get an error on Open function: “proc: Could not open file...
2
2628
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 unknown browsers. But the Python parser doesn't see it that way. No matter what user agent or URL is specified; for that robots.txt file, the only answer is "False". It's failing in Python 2.4 on Windows and 2.5 on Fedora Core.
8
37252
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
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10635
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10115
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7653
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3013
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.