Forum Moderators: open

Message Too Old, No Replies

Getting information about the file that called an asp script

Can I get the name and path of the file in which the script was called?

         

Captaffy

5:05 pm on Dec 9, 2002 (gmt 0)

10+ Year Member



I am working on a biligingual web site, where each page has a button that leads to the other language version of the same content.

Every page has a metatag that has the absolute link to the other language page (ie. <meta name="xxxx.translation content="http://www.somesite.com/blah/file.shtml">).

My employers want the link for the other language button to call an asp script (lang.asp), which would then redirect to the other page. (Okay, they really just told me: "Write an asp script to handle the language switching.")

The way I would like to handle this is to have the script open the page (through the file system) in which the script was called, parse through it until it finds the correct metatag, capture the URL, and then redirect to this page.

Is this possible? Can I determine what file called the script?
Does anyone have any better ideas?

Thanks

korkus2000

6:24 pm on Dec 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use the server variable SCRIPT_NAME to get the page file name. You will use SERVER_NAME for the domain name.

<% Request.ServerVariables("SCRIPT_NAME") %> = /forum47/290.htm
<% Request.ServerVariables("SERVER_NAME") %> = www.webmasterworld.com

Here is a good page on server variables.
[aspfree.com...]

aspdaddy

6:34 pm on Dec 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm doing similar, I wondering whether to use the folder structure to keep it simple, just keep the same file names, and name the folders by the language.

Something like:

<a href="/france/<% Request.ServerVariables("SCRIPT_NAME") %>">This page in French</a>