Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help regarding my subdomain

Status
Not open for further replies.

pbanacos

IS-IT--Management
Apr 21, 2006
34
0
0
US
Hello,

I manage a website that displays a companies daily price on the frontpage. I recently created a mobile subdomain of that site, but when i try to #include the text file from the root directory the values are empty on my subdomain pages. Am I doing anything wrong or do I need a subdomain global.asa that points to root version?

Any help would be appreciated!

Thanks,
Paul
 
pbanacos said:
Am I doing anything wrong or do I need a subdomain global.asa that points to root version?

Absolutely no idea!!


Are you going to help find out by providing some clues? :)?

The code you used preferably, and how the site is structured physically

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Here is the structure:

- I upload and store the daily price in a text file here domain/oilprice/OilPrice.txt
- On my homepage index.asp I have the following entry: <!--#include file="TodayOilPrice.inc"-->
- TodayOilPrice.inc file has this code <%=Session("priceLine")%>
- The global.asa file in the root uses the following code to pull the Price:

<script language="vbscript" runat="server">
sub Session_OnStart
Const Filename = "\oilprice\oilPrices.txt"
Dim FSO
set FSO = server.createObject("Scripting.FileSystemObject")

' Map the logical path to the physical system path
Dim Filepath, price, priceLine, dateLine
Filepath = Server.MapPath(".") & Filename

if FSO.FileExists(Filepath) Then
' Get a handle to the file
Dim file
set file = FSO.GetFile(Filepath)
Dim TextStream
Set TextStream = file.OpenAsTextStream(1, -2)

' Read the file line by line
Do While Not TextStream.AtEndOfStream
Dim sLine
sLine = TextStream.readline
if InStr(1,UCase(sLine),Trim("DATE"))>0 Then
Session("dateLine")=Trim(sLine)
End if
if InStr(1,UCase(sLine),Trim("PRICE"))>0 Then
Session("priceLine")=Trim(sLine)
dim apst1, apst2
apst1 = InStr(1, sLine, "$") ' return position of first '
apst2 = InStr(apst1+1, sLine, "per") ' return position of second '
price = Mid(sLine,apst1+1,(apst2 - apst1)-1)
Session("price")=Trim(price)
End if
Loop
Set TextStream = nothing
End if
end sub
</script>

This works fine for On my subdomain 'mobile.domain.net' I cant figure out how to pull the same value and all I get is null.

Does this help?

Thanks,
Paul
 
It gets a bit further. As you surmised global.asa refers to the running application in the current session which is host name specific. As an application running on a subdomain is on a different hostname the root domain global.asa has not been executed so the session variables will not exist.

In this I have to assume that the 'mobile' subdomain is not mapped to the same physical drive location and files as the site root and the 'www' subdomains are , which is why I asked about the physical structure of the sites on the server drives.



Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top