473,800 Members | 2,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Site Unload?

I want to have an onUnload that runs only when the site is left, not when
the current page is unloaded. Any ideas?

Thanks!

Ross
Jul 23 '05
35 1829
Laurent Bugnion wrote on 20 dec 2004 in comp.lang.javas cript:
OK, that's the case in ASP.NET too (each Page object is deleted at the
end of every call, and of course its members too), but you also have
Session objects, for example you will save there DB connections, file
contents, "global" variables, etc... IIRC, ASP also have the Application
and Session objects, doesn't it? So my question was, how do you know
when to room the resources saved in the Session object if you don't know
when the said session has timed out?


Simple, Laurent, you don't.

Data is needed outside the present session should not be kept in session
memory.

The concept of "having a connection" with the client is a flawed one, as
the connection is not ASP but HTML. [I think hiding this fact of live is my
main objection to asp.net, while sold by MS as a bonus. But let our focus
stay on classic ASP.]

All pertinent data that is not to be lost, should be saved during the asp
execution fase of a single page to a serverside database or other file.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #31
Hi,

Evertjan. wrote:
Laurent Bugnion wrote on 20 dec 2004 in comp.lang.javas cript:

OK, that's the case in ASP.NET too (each Page object is deleted at the
end of every call, and of course its members too), but you also have
Session objects, for example you will save there DB connections, file
contents, "global" variables, etc... IIRC, ASP also have the Application
and Session objects, doesn't it? So my question was, how do you know
when to room the resources saved in the Session object if you don't know
when the said session has timed out?

Simple, Laurent, you don't.

Data is needed outside the present session should not be kept in session
memory.

The concept of "having a connection" with the client is a flawed one, as
the connection is not ASP but HTML. [I think hiding this fact of live is my
main objection to asp.net, while sold by MS as a bonus. But let our focus
stay on classic ASP.]


I didn't mean connections between the client and the server (I am aware
that HTTP is stateless), but rather connections to databases, which can
remain open for example as long as a certain page is displayed, to avoid
re-connecting to the DB every time the page is refreshed. THis is only
an example, BTW. I can think of multiple reasons to cache data in the
Session object.

I am not sure I understand your objection to ASP.NET, maybe you mean
that it gives the programmer the impression that there is a connection
between the client and the server, since the events are redirected to
the correct event handlers automatically, thus hiding the fact that
there is a Request object and a whole HTTP GET or POST process behind
all this. If that's what you mean, then I can ensure you that this basic
fact of life is hidden only from very basic programmers who make very
small Web Applications. As soon as your application is a bit bigger, you
need to have a good knowledge of the exact processes between every
request/response, believe me ;-)
All pertinent data that is not to be lost, should be saved during the asp
execution fase of a single page to a serverside database or other file.


That's not very efficient to say the least.

Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 23 '05 #32
Laurent Bugnion wrote on 20 dec 2004 in comp.lang.javas cript:
I didn't mean connections between the client and the server (I am
aware that HTTP is stateless), but rather connections to databases,
which can remain open for example as long as a certain page is
displayed, to avoid re-connecting to the DB every time the page is
refreshed. THis is only an example, BTW. I can think of multiple
reasons to cache data in the Session object.
I don't think you can keep a database connection open between pages even
while refreshing the same page [as stateless HTML does not see the
difference between same and other, as long as the page is refetched from
the server.]
I am not sure I understand your objection to ASP.NET, maybe you mean
that it gives the programmer the impression that there is a connection
between the client and the server,
YES
since the events are redirected to
the correct event handlers automatically, thus hiding the fact that
there is a Request object and a whole HTTP GET or POST process behind
all this. If that's what you mean, then I can ensure you that this
basic fact of life is hidden only from very basic programmers who make
very small Web Applications.
I don't think so. It is the reason for ASP.Net, me thinks.
As soon as your application is a bit
bigger, you need to have a good knowledge of the exact processes
between every request/response, believe me ;-)


That is why ASP is more logical, since it doesn't hide those things from
view.
All pertinent data that is not to be lost, should be saved during the
asp execution fase of a single page to a serverside database or other
file.


That's not very efficient to say the least.


Perhaps, but it is a fact of stateless HTML life.

Save it or sometimes loose it. The data, I mean.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #33

"Evertjan." <ex************ **@interxnl.net > wrote in message
news:Xn******** ************@19 4.109.133.29...
Laurent Bugnion wrote on 20 dec 2004 in comp.lang.javas cript:
I didn't mean connections between the client and the server (I am
aware that HTTP is stateless), but rather connections to databases,
which can remain open for example as long as a certain page is
displayed, to avoid re-connecting to the DB every time the page is
refreshed. THis is only an example, BTW. I can think of multiple
reasons to cache data in the Session object.


I don't think you can keep a database connection open between pages
even
while refreshing the same page [as stateless HTML does not see the
difference between same and other, as long as the page is refetched
from
the server.]


It's a common mistake to cache DB connections in the session object.
By doing this you prevent another user from re-using the connection
and actually end up putting more load on the server and the DB by
having to carry a larger number of connection.

If you let it, Windows will handle your connection pooling for you:
when you close a connection it will keep it open for a short time and
re-use it for the next request instead of creating a whole new one.
Once you put the connection object into the session your pooling is
shot.

Tim.

Jul 23 '05 #34
Tim Williams wrote on 21 dec 2004 in comp.lang.javas cript:
Once you put the connection object into the session your pooling is
shot.


Do you mean in a session variable?

Since a session variable is only a string,
how can you put an object in a string?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #35
Hi,

Evertjan. wrote:
Tim Williams wrote on 21 dec 2004 in comp.lang.javas cript:

Once you put the connection object into the session your pooling is
shot.

Do you mean in a session variable?

Since a session variable is only a string,
how can you put an object in a string?


No, he means (I think) the Session object. In ASP.NET, each Page is an
object, and has one property named Session (of type HttpSessionStat e),
and this object is a collection in which you can store pretty much
everything you want, including references to other objects.

To Tim: We were not talking necessarily about storing things in the
Session, but rather on the server generally between requests. Other ways
exist in ASP.NET, for example the Application object, static variables,
etc...

Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 23 '05 #36

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

Similar topics

5
20857
by: Harry J. Smith | last post by:
I have written a Visual Basic program that does a long calculation and writes the results to disk as it runs. If I click the Close button the window closes but the program keeps running. How can I get the program to recognize that its window has been closed and quit running? -Harry http://home.netcom.com/~hjsmith
0
4090
by: razheev | last post by:
Hi, I have a Table which contains 1 million rows. I want to do an unload of the table and do some massaging (tranforming) of data and do a load to a different table where the column attributes are different. My question is 1) What options should I use to do a unload so that the unload is very fast using Platinum Fast unload. The table has many columns which defined as VARCHAR. 2)Is there a provision to convert the column values from...
2
10851
by: Lauren Hines | last post by:
Hello, I have read numerous post stating that the only way to unload an assembly (DLL in my case) is to create a separate AppDomain, load the assembly, then unload it by calling AppDomain.Unload. When trying to delete the DLL file I get an exception that access is denied. When trying to copy over the DLL file, I get an exception that it is being used by another process.
1
2654
by: hal | last post by:
I have an application that includes an activex component that consumes resources that must be released when the a page is unloaded. Toward this end I subscribe to the unload event of the body of my page in javascript. However, if I turn on smart navigation, any button that does a server.transfer fails to fire the javascript unload event.
1
2934
by: Hal | last post by:
My most sincere gratitude to anyone who can help me work around this! I have work that needs to be done in javascript on the client whenever a page is unloaded. To this end, I subscribe to the unload event (client side not server side) of the <body> HTML element through javascript.
19
1744
by: Jon Davis | last post by:
I'm reposting this because I really need some advice. I have a web app that makes many queries to the database on every page. In order to save development effort, I've consolidated all database querying to methods in a single static class, so whenever I need data, I pass a SQL string to a method and I am passed a datareader or else individual values (string, integer, etc). There is a horrible memory leak in this application. Just one...
3
3214
by: Gauthier Segay | last post by:
Hello, I've an application where all my pages implement a PAGE_CODE string property, this property is stored in HttpContext.Current.Items. In some page, I must persist data in session while the user perform operation on this page (postback navigation based). I also need to clean up the session data when the user leave the page (by a anyway). My question is about the Unload event, is it safe to use the unload
11
8659
by: Timofmars | last post by:
I'm try to Unload DB2 data from a table into a record sequential file on NT. I can an unload on Mainframe, but it doesn't seem to be an option in NT. In NT, all I can do is export/import. I can do a Load too, but not an Unload. I just want the only the data from the table in a record sequential file. Export seems only to give options to have a delimited line sequential file or a record sequential file where the data is preceeded by...
5
2927
by: =?Utf-8?B?QW5keQ==?= | last post by:
As per the question really. Not trying to stop them leaving, but just detect WHEN they leave the site
0
10507
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10279
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10255
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10036
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9092
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4150
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2948
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.