Alaska Software Inc. - Translating a IIS7 virtual directory within CXP?
Username: Password:
AuthorTopic: Translating a IIS7 virtual directory within CXP?
Nestor G. TorresTranslating a IIS7 virtual directory within CXP?
on Mon, 02 Feb 2015 20:13:49 +0200
Hi

Within CXP I would like to translate a IIS7 virtual directory into a 
real path so that I can use it within my CXP application to open a dbf file.

For example in IIS7 I define /MYFOLDER_VIRTUAL  to point to C:\MYFOLDER
and in CXP I would like to make a translation of /MYFOLDER_VIRTUAL and 
get back C:\MYFOLDER.

This is an urgent matter for me because I am in the process of creating 
multiple websites on one IIS7 server that makes use of my STARLITE CXP 
application.

Kind regards to all
Nestor
Andreas HerdtRe: Translating a IIS7 virtual directory within CXP?
on Tue, 03 Feb 2015 13:55:51 +0100
Hi Nestor,

Deploy the cxp page cxpinfo.cxp, which by default is installed to the 
wwwroot/documentroot folder of the web server, to the directory where the 
cxp page resides. With a web browser navigate to that cxpinfo.cxp page.

Among other information, the physical Folder will be listed.

You can inspect the implementation of the cxpinfo.cxp page to learn how the 
physical Folder can be queried in a cxp page.

Hope this helps,

Andreas Herdt
Alaska Software

--------------------------------------------------------------------

Technical Support: support@alaska-software.com

News Server: news.alaska-software.com
Homepage: http://www.alaska-software.com
WebKnowledgeBase: http://www.alaska-software.com/kbase.shtm

Fax European Office: +49 (0) 61 96 - 77 99 99 23
Fax US Office: +1 (646) 218 1281
--------------------------------------------------------------------

"Nestor G. Torres" schrieb im Newsbeitrag 
news:4f295261$373bef56$be1c2@news.alaska-software.com...

Hi

Within CXP I would like to translate a IIS7 virtual directory into a
real path so that I can use it within my CXP application to open a dbf file.

For example in IIS7 I define /MYFOLDER_VIRTUAL  to point to C:\MYFOLDER
and in CXP I would like to make a translation of /MYFOLDER_VIRTUAL and
get back C:\MYFOLDER.

This is an urgent matter for me because I am in the process of creating
multiple websites on one IIS7 server that makes use of my STARLITE CXP
application.

Kind regards to all
Nestor
Nestor G. TorresRe: Translating a IIS7 virtual directory within CXP?
on Tue, 03 Feb 2015 15:36:16 +0200
Hi Andreas,

Unfortunately the functions/ methods within the cxpinfo.cxp page do not 
have access to my IIS 7 defined virtual directories within the IIS 7 web 
server. This is a pity.


My other two alternatives are
   1) Create a setup.cxp.config  file containing my physical paths to 
the data for each website created within IIS. This would entail having a 
config file for each website directory.

or

   2) make a javascript ajax call to a asp module to translate my 
Virtual  directory names back to physical paths using the following asp 
example code:
     string physicalFilePath = Server.MapPath("~/path/relative/to/my/app");


I'll think about this and tomorrow make up my mind as to how I will proceed.


Thanks for your help
Nestor

On 2015/02/03 02:55 PM, "Andreas Herdt" wrote:
> Hi Nestor,
>
> Deploy the cxp page cxpinfo.cxp, which by default is installed to the
> wwwroot/documentroot folder of the web server, to the directory where
> the cxp page resides. With a web browser navigate to that cxpinfo.cxp page.
>
> Among other information, the physical Folder will be listed.
>
> You can inspect the implementation of the cxpinfo.cxp page to learn how
> the physical Folder can be queried in a cxp page.
>
> Hope this helps,
>
Andreas HerdtRe: Translating a IIS7 virtual directory within CXP?
on Tue, 03 Feb 2015 17:33:17 +0100
Hi Nestor,

Just to make sure. On an IIS7 I have created a virtual directory setting the
physical folder to a location where a cxpinfo.cxp file is. I can invoke this
cxp page via the virtual folder, the physical path of the page is displayed.

I am referring to following line in the cxpinfo.cxp page:

oTab:AddRow("PhysicalPath",SELF:PhysicalPath)

If the problem is with writing to this physical folder then be sure the
folder has the proper credentials set. For example, in my case I have 
applied
"Full control" for the user IIS_IUSRS.

Please also refer to resources available in the internet for further 
information.
For example, ask Dr. Google and also refer to www.iis.net.

Hope this helps.

With my best regards,


Andreas Herdt
Alaska Software

--------------------------------------------------------------------

Technical Support: support@alaska-software.com

News Server: news.alaska-software.com
Homepage: http://www.alaska-software.com
WebKnowledgeBase: http://www.alaska-software.com/kbase.shtm

Fax European Office: +49 (0) 61 96 - 77 99 99 23
Fax US Office: +1 (646) 218 1281
--------------------------------------------------------------------
"Nestor G. Torres" schrieb im Newsbeitrag 
news:3551e178$4e619830$fcd97@news.alaska-software.com...

Hi Andreas,

Unfortunately the functions/ methods within the cxpinfo.cxp page do not
have access to my IIS 7 defined virtual directories within the IIS 7 web
server. This is a pity.


My other two alternatives are
   1) Create a setup.cxp.config  file containing my physical paths to
the data for each website created within IIS. This would entail having a
config file for each website directory.

or

   2) make a javascript ajax call to a asp module to translate my
Virtual  directory names back to physical paths using the following asp
example code:
     string physicalFilePath = Server.MapPath("~/path/relative/to/my/app");


I'll think about this and tomorrow make up my mind as to how I will proceed.


Thanks for your help
Nestor

On 2015/02/03 02:55 PM, "Andreas Herdt" wrote:
> Hi Nestor,
>
> Deploy the cxp page cxpinfo.cxp, which by default is installed to the
> wwwroot/documentroot folder of the web server, to the directory where
> the cxp page resides. With a web browser navigate to that cxpinfo.cxp 
> page.
>
> Among other information, the physical Folder will be listed.
>
> You can inspect the implementation of the cxpinfo.cxp page to learn how
> the physical Folder can be queried in a cxp page.
>
> Hope this helps,
>
Nestor G. TorresRe: Translating a IIS7 virtual directory within CXP?
on Wed, 04 Feb 2015 07:15:59 +0200
Hi Andreas,

I've tried qualifying the SELF:PhysicalPath("/TEST2") to try and get my 
virtual directory that I defined within IIS7; but as I thought it 
crashes the cxpinfo page.

Here is an example of my three virtual directories that I create within 
a IIS7 website:

/TEST1     points to    c:\testdata1\data
/TEST2     points to    c:\testdata2\data
/TEST3     points to    c:\testdata3\data

The question is how can I use the PhysicalPath object to provide me on 
request the physical path for /TEST1 or /TEST2 or /TEST3

As I understand it the PhysicalPath will always return the root physical 
path of where DOM html/CXP/js...ECT modules reside ....giving:
c:\inetpub\wwwroot\


Or am I misunderstanding something?

So far the only thing that I have found to work is within ASP or PHP and 
these two technologies support:
cPhysicalpath=Server.MapPath("/TVHS2")
where the resulting cPhysicalpath will contain "c:\testdata2\data"

Kind regards,
Nestor





On 2015/02/03 06:33 PM, "Andreas Herdt" wrote:
> Hi Nestor,
>
> Just to make sure. On an IIS7 I have created a virtual directory setting
> the
> physical folder to a location where a cxpinfo.cxp file is. I can invoke
> this
> cxp page via the virtual folder, the physical path of the page is
> displayed.
>
> I am referring to following line in the cxpinfo.cxp page:
>
> oTab:AddRow("PhysicalPath",SELF:PhysicalPath)
>
> If the problem is with writing to this physical folder then be sure the
> folder has the proper credentials set. For example, in my case I have
> applied
> "Full control" for the user IIS_IUSRS.
>
> Please also refer to resources available in the internet for further
> information.
> For example, ask Dr. Google and also refer to www.iis.net.
>
> Hope this helps.
>
> With my best regards,
>
>
Andreas HerdtRe: Translating a IIS7 virtual directory within CXP?
on Wed, 04 Feb 2015 15:53:41 +0100
Hi Nestor,

:PhysicalPath is not a method, it is a member variable. The member
variable holds the physical path the the cxp page being executed.

Assume a virtual directory "test" then a CXP page can be reachable
using the URL "http://localhost/test/cxpinfo.cxp"

This is what the pages membervariable :PhysicalPath would contain:

"c:\users\nestor\documents\xbase++\projects\webpages\expermint\cxpinfo.cxp"

As far as I understand, this is what you need.

Please investigate what the cxpinfo.cxp page is showing you. I think
things will get clearer then.

With my best regards,

Andreas Herdt
Alaska Software

--------------------------------------------------------------------

Technical Support: support@alaska-software.com

News Server: news.alaska-software.com
Homepage: http://www.alaska-software.com
WebKnowledgeBase: http://www.alaska-software.com/kbase.shtm

Fax European Office: +49 (0) 61 96 - 77 99 99 23
Fax US Office: +1 (646) 218 1281
--------------------------------------------------------------------

"Nestor G. Torres" schrieb im Newsbeitrag 
news:3c7c5242$1bcbe33$117e6e@news.alaska-software.com...

Hi Andreas,

I've tried qualifying the SELF:PhysicalPath("/TEST2") to try and get my
virtual directory that I defined within IIS7; but as I thought it
crashes the cxpinfo page.

Here is an example of my three virtual directories that I create within
a IIS7 website:

/TEST1     points to    c:\testdata1\data
/TEST2     points to    c:\testdata2\data
/TEST3     points to    c:\testdata3\data

The question is how can I use the PhysicalPath object to provide me on
request the physical path for /TEST1 or /TEST2 or /TEST3

As I understand it the PhysicalPath will always return the root physical
path of where DOM html/CXP/js...ECT modules reside ....giving:
c:\inetpub\wwwroot\


Or am I misunderstanding something?

So far the only thing that I have found to work is within ASP or PHP and
these two technologies support:
cPhysicalpath=Server.MapPath("/TVHS2")
where the resulting cPhysicalpath will contain "c:\testdata2\data"

Kind regards,
Nestor





On 2015/02/03 06:33 PM, "Andreas Herdt" wrote:
> Hi Nestor,
>
> Just to make sure. On an IIS7 I have created a virtual directory setting
> the
> physical folder to a location where a cxpinfo.cxp file is. I can invoke
> this
> cxp page via the virtual folder, the physical path of the page is
> displayed.
>
> I am referring to following line in the cxpinfo.cxp page:
>
> oTab:AddRow("PhysicalPath",SELF:PhysicalPath)
>
> If the problem is with writing to this physical folder then be sure the
> folder has the proper credentials set. For example, in my case I have
> applied
> "Full control" for the user IIS_IUSRS.
>
> Please also refer to resources available in the internet for further
> information.
> For example, ask Dr. Google and also refer to www.iis.net.
>
> Hope this helps.
>
> With my best regards,
>
>
Nestor G. TorresRe: Translating a IIS7 virtual directory within CXP?
on Wed, 04 Feb 2015 19:41:45 +0200
HI Andreas,

Unfortunately my communications have not established my needs clearly.

As a final parting communication:
The reason I need to interpret the IIS7 virtual directories is not to 
access a web page but to access different data paths to my dbf files 
within one CXP application page.

If you have time try the following experiment:

1) create the following test folders on your hard drive
    a) c:\testfolder1\data
    b) c:\testfolder2\data
    c) c:\testfolder3\data
    * then put some dbf files into each folder

2) within IIS7 create the following three virtual directories
    /TEST1    and point it to physical path a) above
    /TEST2    and point it to physical path b) above
    /TEST3    and point it to physical path c) above
3) now in one test cxp application within your c:\inetpub\wwwroot\ open 
three  three dbf files:
   a) open a dbf file with only knowing its virtual directory /TEST1
   b) open another dbf file with only knowing its virtual directory /TEST2
   c) open another dbf file with only knowing its virtual directory /TEST3

I have tried the above with endless combinations of CXP code but could 
not do it using straight CXP. Note that I do have a solution so this is 
not as urgent as before; but it would be nice if I could do it with CXP 
code.

Note that I have studied your cxpinfo.cxp page but I could not find an 
answer that would satisfy the above requirement. I have put in the time.

Kind regards,
Nestor






On 2015/02/04 04:53 PM, "Andreas Herdt" wrote:
> Hi Nestor,
>
> :PhysicalPath is not a method, it is a member variable. The member
> variable holds the physical path the the cxp page being executed.
>
> Assume a virtual directory "test" then a CXP page can be reachable
> using the URL "http://localhost/test/cxpinfo.cxp"
>
> This is what the pages membervariable :PhysicalPath would contain:
>
> "c:\users\nestor\documents\xbase++\projects\webpages\expermint\cxpinfo.cxp"
>
> As far as I understand, this is what you need.
>
> Please investigate what the cxpinfo.cxp page is showing you. I think
> things will get clearer then.
>
> With my best regards,
>
Andreas HerdtRe: Translating a IIS7 virtual directory within CXP?
on Thu, 05 Feb 2015 10:20:55 +0100
Hi Nestor,

Thanks for explaining again.

You like to query the physical path from a virtual drive. You like to
do that with a generic mechanism, usable from a CXP page that
resides whereever.

So the answer is no. You can not do that from a CXP page, for this
it is required to ask the server (how ever) what is configured.

You would read some configuration file where this kind of
information is available.

Does this help?

With my best regards,

Andreas Herdt
Alaska Software

--------------------------------------------------------------------

Technical Support: support@alaska-software.com

News Server: news.alaska-software.com
Homepage: http://www.alaska-software.com
WebKnowledgeBase: http://www.alaska-software.com/kbase.shtm

Fax European Office: +49 (0) 61 96 - 77 99 99 23
Fax US Office: +1 (646) 218 1281
--------------------------------------------------------------------

"Nestor G. Torres" schrieb im Newsbeitrag 
news:70f3b164$408f6ebd$7815@news.alaska-software.com...


HI Andreas,

Unfortunately my communications have not established my needs clearly.

As a final parting communication:
The reason I need to interpret the IIS7 virtual directories is not to
access a web page but to access different data paths to my dbf files
within one CXP application page.

If you have time try the following experiment:

1) create the following test folders on your hard drive
    a) c:\testfolder1\data
    b) c:\testfolder2\data
    c) c:\testfolder3\data
    * then put some dbf files into each folder

2) within IIS7 create the following three virtual directories
    /TEST1    and point it to physical path a) above
    /TEST2    and point it to physical path b) above
    /TEST3    and point it to physical path c) above
3) now in one test cxp application within your c:\inetpub\wwwroot\ open
three  three dbf files:
   a) open a dbf file with only knowing its virtual directory /TEST1
   b) open another dbf file with only knowing its virtual directory /TEST2
   c) open another dbf file with only knowing its virtual directory /TEST3

I have tried the above with endless combinations of CXP code but could
not do it using straight CXP. Note that I do have a solution so this is
not as urgent as before; but it would be nice if I could do it with CXP
code.

Note that I have studied your cxpinfo.cxp page but I could not find an
answer that would satisfy the above requirement. I have put in the time.

Kind regards,
Nestor






On 2015/02/04 04:53 PM, "Andreas Herdt" wrote:
> Hi Nestor,
>
> :PhysicalPath is not a method, it is a member variable. The member
> variable holds the physical path the the cxp page being executed.
>
> Assume a virtual directory "test" then a CXP page can be reachable
> using the URL "http://localhost/test/cxpinfo.cxp"
>
> This is what the pages membervariable :PhysicalPath would contain:
>
> "c:\users\nestor\documents\xbase++\projects\webpages\expermint\cxpinfo.cxp"
>
> As far as I understand, this is what you need.
>
> Please investigate what the cxpinfo.cxp page is showing you. I think
> things will get clearer then.
>
> With my best regards,
>
Thomas BraunRe: Translating a IIS7 virtual directory within CXP?
on Thu, 05 Feb 2015 10:44:46 +0100
Andreas Herdt wrote:

> So the answer is no. You can not do that from a CXP page, for this
> it is required to ask the server (how ever) what is configured.

After a few minutes searching I think WMI might be one way to do this:

https://msdn.microsoft.com/en-us/library/ms525309%28v=vs.90%29.aspx

https://msdn.microsoft.com/en-us/library/ms525879%28v=vs.90%29.aspx

But I'm not sure if WMI is fast enough to do this for each access...
probably the information which virtual directories point to what location
needs to be cached.

Thomas
Nestor G. TorresRe: Translating a IIS7 virtual directory within CXP?
on Thu, 05 Feb 2015 13:12:13 +0200
Hi Andeas,

Thank you for the answer at least now I know.

Note that I do have an alternate solution which works for me.
The solution involves using a very simple asp module that I wrote.
It seems to work very fast and gives me the physical path for a virtual 
directory on the fly. I only call the module once during the startup of
a Starlite session and then call a cxp module to create a session 
variable for the directory.

Being able to translate virtual directories allows me to run
multiple Starlite stores under one IIS web server.

Following is asp code for doing this:

<%
'/* Get a virtual directory from the local web server           */
'/* This asp app gets the virtual directory "/TVHS2"            */
'/* and returns the physical path "c:\TVHS"                      */
'/* Note the request.form("virtualDirectory") this is the virtual*/
'/* to be translated                                             */

dim physicalFilePath

physicalFilePath = Server.MapPath(request.form("virtualDirectory"))
response.write(physicalFilePath)

%>

Kind Regards,
Nestor



On 2015/02/05 11:20 AM, "Andreas Herdt" wrote:
> Hi Nestor,
>
> Thanks for explaining again.
>
> You like to query the physical path from a virtual drive. You like to
> do that with a generic mechanism, usable from a CXP page that
> resides whereever.
>
> So the answer is no. You can not do that from a CXP page, for this
> it is required to ask the server (how ever) what is configured.
>
> You would read some configuration file where this kind of
> information is available.
>
> Does this help?
>
> With my best regards,
>