How to get the web site physical path

J

Jaime Stuardo

Hi all...

How can I get the physical path of a web site from an EXE application? The
Web Site is on the same server as the application.

Thanks in advance
Jaime
 
M

McKirahan

Jaime Stuardo said:
Hi all...

How can I get the physical path of a web site from an EXE application? The
Web Site is on the same server as the application.

Thanks in advance
Jaime

Request.ServerVariables("APPL_PHYSICAL_PATH")
or
Request.ServerVariables("PATH_TRANSLATED")
may give you what you want.
 
J

Jaime Stuardo

But I cannot access server variables when I am in an EXE application since
it is ran in a different context. Or do you know a way how to get a
reference to the Request object from an EXE application?

Thanks
Jaime
 
M

McKirahan

Jaime Stuardo said:
But I cannot access server variables when I am in an EXE application since
it is ran in a different context. Or do you know a way how to get a
reference to the Request object from an EXE application?

[snip]

Could you be more specific about what you're trying to do and why?
 
J

Jaime Stuardo

I thought it was clear, sorry..

I have a VB application compiled as an EXE file that is scheduled to ran at
certain time. That EXE file accesses some configuration information from a
web site. That configuration information is, for example, some connection
strings.

That information is present in a file under the web site directory. That's
why I need to get the physical path of it. I want to do that so that I don't
need to hard code the path.

3 things to have in mind :

- The system is already designed. I'm just correcting some errors produced
when my customer moved some directories from one partition to another.
- I cannot use an INI file
- I can hard-code the path, but if for some reason, the customer move the
files again from one partition to another, or from one directory to another,
the system will fail again.

Thanks
Jaime

McKirahan said:
Jaime Stuardo said:
But I cannot access server variables when I am in an EXE application
since
it is ran in a different context. Or do you know a way how to get a
reference to the Request object from an EXE application?

[snip]

Could you be more specific about what you're trying to do and why?
 
M

McKirahan

Jaime Stuardo said:
I thought it was clear, sorry..

I have a VB application compiled as an EXE file that is scheduled to ran at
certain time. That EXE file accesses some configuration information from a
web site. That configuration information is, for example, some connection
strings.

That information is present in a file under the web site directory. That's
why I need to get the physical path of it. I want to do that so that I don't
need to hard code the path.

3 things to have in mind :

- The system is already designed. I'm just correcting some errors produced
when my customer moved some directories from one partition to another.
- I cannot use an INI file
- I can hard-code the path, but if for some reason, the customer move the
files again from one partition to another, or from one directory to another,
the system will fail again.

[snip]

Have you tried "App.Path" in your VB application?

(Note -- this is a VB question not an ASP question.)
 
B

Bob Barrows [MVP]

Your web site will need to have an ASP page that returns the physical path
(via the servervariables, or by using server.mappath).
You VB ap will need to use the XMLHTTPRequest object (it's part of the msxml
parser) to request the page and receive its response.

You can get more details in a VB group.

Bob Barrows


Jaime said:
I thought it was clear, sorry..

I have a VB application compiled as an EXE file that is scheduled to
ran at certain time. That EXE file accesses some configuration
information from a web site. That configuration information is, for
example, some connection strings.

That information is present in a file under the web site directory.
That's why I need to get the physical path of it. I want to do that
so that I don't need to hard code the path.

3 things to have in mind :

- The system is already designed. I'm just correcting some errors
produced when my customer moved some directories from one partition
to another. - I cannot use an INI file
- I can hard-code the path, but if for some reason, the customer move
the files again from one partition to another, or from one directory
to another, the system will fail again.

Thanks
Jaime

McKirahan said:
Jaime Stuardo said:
But I cannot access server variables when I am in an EXE application
since
it is ran in a different context. Or do you know a way how to get a
reference to the Request object from an EXE application?

[snip]

Could you be more specific about what you're trying to do and why?
 
J

Jaime Stuardo

Thanks Bob... Your solution worked.

Jaime

Bob Barrows said:
Your web site will need to have an ASP page that returns the physical path
(via the servervariables, or by using server.mappath).
You VB ap will need to use the XMLHTTPRequest object (it's part of the
msxml parser) to request the page and receive its response.

You can get more details in a VB group.

Bob Barrows


Jaime said:
I thought it was clear, sorry..

I have a VB application compiled as an EXE file that is scheduled to
ran at certain time. That EXE file accesses some configuration
information from a web site. That configuration information is, for
example, some connection strings.

That information is present in a file under the web site directory.
That's why I need to get the physical path of it. I want to do that
so that I don't need to hard code the path.

3 things to have in mind :

- The system is already designed. I'm just correcting some errors
produced when my customer moved some directories from one partition
to another. - I cannot use an INI file
- I can hard-code the path, but if for some reason, the customer move
the files again from one partition to another, or from one directory
to another, the system will fail again.

Thanks
Jaime

McKirahan said:
But I cannot access server variables when I am in an EXE application
since
it is ran in a different context. Or do you know a way how to get a
reference to the Request object from an EXE application?

[snip]

Could you be more specific about what you're trying to do and why?

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top