473,378 Members | 1,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Session variables - scope

Greetings one and all.

Server: Win2k(server)/IIS-5

There are many web sites on the server - each has a virtual directory
pointer to a common directory containing frequently used routines.

Scripts run from the virtual directory appear to have no access to session
(or application) variables. Is this expected behaviour? Or have I yet to
track down a bug?

--
William Tasso - http://WilliamTasso.com
Jul 19 '05 #1
8 3596
Application and session variables are unique to each application
defininition in IIS. When you create a virtual directory in IIS, a new
application is created for that directory by default. You can remove it,
and then it will be in the parent application.

Ray at work

"William Tasso" <ne****@tbdata.com> wrote in message
news:u%****************@TK2MSFTNGP09.phx.gbl...
Greetings one and all.

Server: Win2k(server)/IIS-5

There are many web sites on the server - each has a virtual directory
pointer to a common directory containing frequently used routines.

Scripts run from the virtual directory appear to have no access to session
(or application) variables. Is this expected behaviour? Or have I yet to
track down a bug?

--
William Tasso - http://WilliamTasso.com

Jul 19 '05 #2
Ray at <%=sLocation%> wrote:
Application and session variables are unique to each application
defininition in IIS. When you create a virtual directory in IIS, a
new application is created for that directory by default. You can
remove it, and then it will be in the parent application.

Thanks for the info.

If it's not straying too far OT, are there any hints at how one might
achieve such a thing and whether there are any gotchas lying in wait for the
unwary.

or

perhaps an alternative method of providing reusable script modules to many
individual web sites on the same server.
--
William Tasso - http://WilliamTasso.com
Jul 19 '05 #3
You can include the files with functions in them and then call the
functions:

incStringConcat.asp
====
<%
function StringConcat(Sting1, String2)
StringConcat = String1 & String2
end function
%>
====
default.asp
====
<!-- #INCLUDE FILE="incStringConcat.asp" -->
Concat "Hello" and " World!"<br>
<%
response.write(StringConcat("Hello"," World!"))
%>
====

Obviously a very simple example, but in that way you can pass variables to
your functions and share the functions.
"William Tasso" <ne****@tbdata.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Ray at <%=sLocation%> wrote:
Application and session variables are unique to each application
defininition in IIS. When you create a virtual directory in IIS, a
new application is created for that directory by default. You can
remove it, and then it will be in the parent application.
Thanks for the info.

If it's not straying too far OT, are there any hints at how one might
achieve such a thing and whether there are any gotchas lying in wait for

the unwary.

or

perhaps an alternative method of providing reusable script modules to many
individual web sites on the same server.
--
William Tasso - http://WilliamTasso.com

Jul 19 '05 #4
dlbjr wrote:

Many thanks to you both for your input.
William I do this with virtual includes.
ok - that's where I'm at.
I have many asp files with server side scripts.
The code is mainly VBScript Classes I use as Objects in any other
code. I include them in any web app with a virtual include in the asp.
Yep - that's what I'm doing. I have public properties and functions, some
of which call private functions. I'm in the process of building
encapsulated components for other developers to include in their sites and
was trying to abstract them even further so that just using the virtual
include world run trivial code, but I got a bit stuck with the
session/application variables. Still can't think of a way to completely
automate and encapsulate without hard-coding or using the suggestion from
Ray.
I have attached my main include Object that all my asp pages extend
from.


Thank you for the insight - very generous of you.

--
William Tasso
Jul 19 '05 #5
William,

The code is ran within the calling asp.
The Session and Application Variables for the App running are accessible in
the included code.

What exactly is the problem?
Are you trying to maintain central Application vars for all applications?

-dlbjr

Discerning resolutions for the alms
Jul 19 '05 #6
dlbjr wrote:
William,

The code is ran within the calling asp.
yep
The Session and Application Variables for the App running are
accessible in the included code.
Not in this instance. The included code is located in the virtual directory
and appears (like Ray said) to behave like a new application.

What exactly is the problem?
Are you trying to maintain central Application vars for all
applications?


No - I guess that would be a different issue completely.

I'm building server side components for use by web deezinerzzz. This
particular component could produce all that's required of it with just a few
variable values. I was trying to dumb it down - too far, perhaps - so that
it would work with just the include.

--
William Tasso - http://WilliamTasso.com
Jul 19 '05 #7
It shouldn't do this.

I do the virtual include thing on NT4 and 2000 and works fine (the same) on
both.

Can I see some code that is not working?

-dlbjr

Discerning resolutions for the alms
Jul 19 '05 #8
dlbjr wrote:
It shouldn't do this.

I do the virtual include thing on NT4 and 2000 and works fine (the
same) on both.

Can I see some code that is not working?


ok - I knocked-up a sample to test and you're right - it works fine. So I
looked at the dev code and realised I've coded a response.redirect and it's
the target of that call that can't access the session/application vars - it
lives in the virtual directory. Replaced the redirect with a
server.transfer and all is well in my world (till the next gotcha) - still
got some tidying to do but it's worth the pain. Many thanks for your help.

--
William Tasso - http://WilliamTasso.com
Jul 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Nicole | last post by:
Hi I'm trying to use a function to set a session variable. I have three files: The first file has: <?php session_start(); // This connects to the existing session ?> <html> <head>
4
by: Dean | last post by:
I finally got class session variables to work by putting the following in global.asax in the session_start: dim myDBComp as DBComp = new DBComp........ session("myDBComp") = myDBComp In each...
4
by: John Smith Jr. | last post by:
Could someone enlighten me what the difference between viewstate[" and session[" variables in terms of use, performance, and rule of thumb, from what I understand viewstate has overhead to it, and...
2
by: Joe Molloy | last post by:
Hi, This isn't a mission critical question but I thought I'dl throw it out there for your feedback as it's a bit curious. I have developed a shopping cart for an application I'm working on...
8
by: Dave Wurtz | last post by:
All, I'm new to ASP development and I have a basic design question: Is it ok to store business objects to session variables or is there a better way to keep object information? For example,...
2
by: Don | last post by:
I'm asking this for a friend of mine, so forgive me if I'm getting some of the terminology wrong (I don't have any experience with ASP.NET). I've got an ASP application that has some classes that...
31
by: Harry Simpson | last post by:
I've come from the old ASP camp where session variables were not used. When i started using ASP.NET in 2001, I started using them again because it was ok from what I'd read. I've been merrily...
9
by: Randy | last post by:
Hello, I'm having a strange problem. I've got a .NET web app which uses Session variables. Sometime, not all the time, they get cross threaded...that is...one user will have another user's Session...
18
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that...
3
by: mikeboston | last post by:
Hi, I am attempting to use php session variables on a server which is running Red Hat Linux, but the variables don't seem to be getting passed between pages. I have tried the same exact test...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.