Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 31st, 2003, 01:51 PM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unassigned Application Variables

Hi,

I'm trying to use what I'm learning from this book and experimenting with a test app. I have built a folder hierarchy and created a web app pointing to the top level folder and virtual directories pointing to the subfolders. However, I notice that application variables that I assign in my global.asa file are sometimes, but not always, unassigned as I switch to a different folder. What could be causing that, and how can I ensure that these variables stay assigned throughout the life of the app? Or am I missing the larger picture that there is a one-to-one correspondence between web apps and folders, and that it is just a fluke that these variables sometimes do remain assigned?

  #2 (permalink)  
Old October 31st, 2003, 01:55 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Application variables should keep their value for all subfolders between the "application root".

The "application root" is something you can define yourself using the IIS Management Console. If you change a directory into a Virtual Directory, it will act as a different application with different application variables (not 100% sure if you do need a global.asa file, though).

So, as long as you have a single application root, all other normal folders beneath it, should be able to read and set the same set of application variables.

If this is not the case, maybe you can post some code and describe your situation in some more detail. AFAIK, the way you describe things shouldn't happen.....


Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #3 (permalink)  
Old October 31st, 2003, 02:08 PM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your your prompt response. So is the issue then whether I use a physical reference to the subfolder or a virtual directory, the former being part of the same application while the latter being a separate application?

  #4 (permalink)  
Old October 31st, 2003, 04:58 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

I am not sure what you mean, but consider this example:
Code:
C:\Inetpub\wwwroot\           <-- Usually the Web Root
C:\Inetpub\wwwroot\Admin      <-- Just a simple folder
C:\Inetpub\wwwroot\MyNewApp   <-- A new Virtual Dir
C:\Inetpub\wwwroot\Admin      <-- Just a simple folder
If you look at these four folder, you'll see that the wwwroot and the MyNewApp are both a separate application (that is, if you changed MyNewApp into a Virtual Directory through IIS).

The folders Admin in both example will belong to their parent application. That means that ASP pages in the First Admin folder cam't read application variables created in the other Admin folder (or its parent).

By changing your normal folders into Virtual Directories, you'll create a separate application scope.

Does that make sense?


Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #5 (permalink)  
Old October 31st, 2003, 07:49 PM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Absolutely. Many thanks. Just tried it by "removing" the virtual directories I had linked to my physical folders and my application variables were pretty much saved. So, as you have explained, there is a 1-1 correspondence between web apps and virtual folders.

Thanks again for your help.

P.S. I wonder if you can help me with the other message I posted earlier regarding writing to web directories using the Record object's CopyRecord method. I'm really stuck on that one.

  #6 (permalink)  
Old October 31st, 2003, 07:58 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Yeah sure. Is it this one:

http://p2p.wrox.com/topic.asp?TOPIC_ID=1385

or this one:

http://p2p.wrox.com/topic.asp?TOPIC_ID=5628

For the first one, you should indeed check the "Script Blocking" feature of your Anti-virus program. There is no need to disable the entire program, just make sure that script blocking is turned of.
If it's the latter, can you post the code you're having problems with in that thread? I don't have the book, so it's hard to see what's going on. I may take until tomorrow until I have the time to look at it.....

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #7 (permalink)  
Old November 3rd, 2003, 02:35 PM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It's the

http://p2p.wrox.com/topic.asp?TOPIC_ID=5628

topic, and I've added the code as a reply to that topic. I tried that one as well with scripting off in NAV with no success.


 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.exit() fails to terminate application. saumya General .NET 1 January 4th, 2008 09:50 AM
sharing variables throughtout the jsp application kanoorani JSP Basics 3 April 23rd, 2007 11:36 PM
Application variables brettk_1 VB.NET 1 February 9th, 2007 08:37 AM
Blog application: Is this an Error in application yousaid BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 31 February 7th, 2007 02:57 PM
diff between application and session variables? hrishimusale Classic ASP Basics 2 August 27th, 2003 08:00 PM



All times are GMT -4. The time now is 07:38 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.