SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    May 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question about Application Variables

    Hey all,

    Let's say we have a bunch of websites, owned by different people. The sites are all different, but the common theme is they are car enthusiast websites.

    Each of these websites has their own unique index page (of course), but also "common" pages, which are pages shared by all the websites.

    One of the common pages, checks for the value of an application variable, which may or may not exist. For example, lets call this page luxurycars.asp, which is a simple page that shows the top 10 luxury cars of this year.

    This common luxury car page will pull and use the app variable like so:
    Code:
    Dim SiteOwner
    SiteOwner = Application("OwnerName")
    Response.Write("This site is managed by " & SiteOwner)

    This app variable is set uniquely in each clients index.asp page like so:
    Code:
    Application("OwnerName") = "John Doe"

    Will this work? I just started learning classic ASP (for my job), and I'm reading that application variables are universal and only one copy of the variable will exist.

    So does this mean if John Doe sets Application("OwnerName") to "John Doe" in HIS index.asp page, will everyone that visits the common luxury car page see John Doe's name? Regardless of whether they got to that page via John Doe's page or someone elses?

    And if so would using a Session variable instead solve this problem?


    Sorry if this sounds confusing, let me know if I need to re-word it or give more detail...

  2. #2
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    australia
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So from what i understand you want to change the header of the page based on the directing url. so if the original website (website1.com) that the browser is on then clicks on luxurycars.asp that is loacted on another url (website2.com) then the header would still show (website1.com).

    Is that right?

  3. #3
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Application variables are for everyone. Session variables are for individual users.

    In your case you would want to apply Session variables. But be aware Session variables expire within set time limits.

    To know who is on line to generate the correct output, the anonymous user will need to login and identify themselves.

    In lieu of using session variables cookies could also be applied, after successful login, for correct ID recognition/ output generation.

  4. #4
    SitePoint Addict
    Join Date
    Apr 2009
    Posts
    359
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If your websites are each in their own IIS web application, then you'll be OK. Each web application defined will get it's own application object.
    Doug G
    =====
    "If you ain't the lead dog, the view is always the same - Anon


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •