INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Need help regarding my subdomain

Need help regarding my subdomain

(OP)
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

RE: Need help regarding my subdomain

Quote (pbanacos)

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? smile?

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

RE: Need help regarding my subdomain

(OP)
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 www.domain.net
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




RE: Need help regarding my subdomain

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close