473,795 Members | 2,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Class not getting destroyed on Redirect

Hello,

I have a page that creates a class, and then on certain conditions,
redirects user to another page. The class has a Class_Terminate () function
that saves itself to a database. The class comes from an includes ASP file,
it isn't a COM object.

Here's my code outline (not actual code for brevity - in otherwords, there
may be syntax errors, but that's not the cause of the problem)

<!--#include file="myclass.a sp">
<%
objClass = new cMyClass
cMyClass.variab le = "Somethign"

if (somecondition) then
response.redire ct("someotherpa ge.asp")
end if

%>
The problem I am having is that if the page does not redirect, cMyClass's
Class_Terminate function is run, however, if the redirect statement is run,
Class_Terminate doesn't get run.

Is this a known problem in ASP classic?
Jul 19 '05 #1
5 2196
Try:

Set objClass = new cMyClass
cMyClass.variab le = "Somethign"

if (somecondition) then
Set objClass=Nothin g
response.redire ct("someotherpa ge.asp")
end if
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steve Lutz" <sl***@comcast. net> wrote in message
news:eF******** ******@TK2MSFTN GP12.phx.gbl...
Hello,

I have a page that creates a class, and then on certain conditions,
redirects user to another page. The class has a Class_Terminate () function
that saves itself to a database. The class comes from an includes ASP file, it isn't a COM object.

Here's my code outline (not actual code for brevity - in otherwords, there
may be syntax errors, but that's not the cause of the problem)

<!--#include file="myclass.a sp">
<%
objClass = new cMyClass
cMyClass.variab le = "Somethign"

if (somecondition) then
response.redire ct("someotherpa ge.asp")
end if

%>
The problem I am having is that if the page does not redirect, cMyClass's
Class_Terminate function is run, however, if the redirect statement is run, Class_Terminate doesn't get run.

Is this a known problem in ASP classic?

Jul 19 '05 #2
Hi, I guess I should clarify, I was trying to generalize the problem..

The object I'm using is going to be used globally through-out the site to
ensure user is logged in. To make future pages easier to code, the object
Class_initializ e function reads cookies, and attempts to authenticate the
user. If unable to, then the user is redirected to an login page. Since it
is the class itself doing the redirect, then it isn't possible for the class
to destroy itself.

<!--#include file="myclass.a sp">
<%
objClass = new cMyClass

' If I get here then the user is logged in.

%>


"Mark Schupp" <ms*****@ielear ning.com> wrote in message
news:un******** ******@TK2MSFTN GP10.phx.gbl...
Try:

Set objClass = new cMyClass
cMyClass.variab le = "Somethign"

if (somecondition) then
Set objClass=Nothin g
response.redire ct("someotherpa ge.asp")
end if
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steve Lutz" <sl***@comcast. net> wrote in message
news:eF******** ******@TK2MSFTN GP12.phx.gbl...
Hello,

I have a page that creates a class, and then on certain conditions,
redirects user to another page. The class has a Class_Terminate () function that saves itself to a database. The class comes from an includes ASP

file,
it isn't a COM object.

Here's my code outline (not actual code for brevity - in otherwords, there may be syntax errors, but that's not the cause of the problem)

<!--#include file="myclass.a sp">
<%
objClass = new cMyClass
cMyClass.variab le = "Somethign"

if (somecondition) then
response.redire ct("someotherpa ge.asp")
end if

%>
The problem I am having is that if the page does not redirect, cMyClass's Class_Terminate function is run, however, if the redirect statement is

run,
Class_Terminate doesn't get run.

Is this a known problem in ASP classic?


Jul 19 '05 #3
put the redirect into the include file outside of the class

'class definition here

Dim objClass
Set objClass = new cMyClass

if (objClass.mustr edirect() ) then
Set objClass=Nothin g
response.redire ct("someotherpa ge.asp")
end if

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steve Lutz" <sl***@comcast. net> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Hi, I guess I should clarify, I was trying to generalize the problem..

The object I'm using is going to be used globally through-out the site to
ensure user is logged in. To make future pages easier to code, the object
Class_initializ e function reads cookies, and attempts to authenticate the
user. If unable to, then the user is redirected to an login page. Since it
is the class itself doing the redirect, then it isn't possible for the class to destroy itself.

<!--#include file="myclass.a sp">
<%
objClass = new cMyClass

' If I get here then the user is logged in.

%>


"Mark Schupp" <ms*****@ielear ning.com> wrote in message
news:un******** ******@TK2MSFTN GP10.phx.gbl...
Try:

Set objClass = new cMyClass
cMyClass.variab le = "Somethign"

if (somecondition) then
Set objClass=Nothin g
response.redire ct("someotherpa ge.asp")
end if
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steve Lutz" <sl***@comcast. net> wrote in message
news:eF******** ******@TK2MSFTN GP12.phx.gbl...
Hello,

I have a page that creates a class, and then on certain conditions,
redirects user to another page. The class has a Class_Terminate () function that saves itself to a database. The class comes from an includes ASP

file,
it isn't a COM object.

Here's my code outline (not actual code for brevity - in otherwords, there may be syntax errors, but that's not the cause of the problem)

<!--#include file="myclass.a sp">
<%
objClass = new cMyClass
cMyClass.variab le = "Somethign"

if (somecondition) then
response.redire ct("someotherpa ge.asp")
end if

%>
The problem I am having is that if the page does not redirect, cMyClass's Class_Terminate function is run, however, if the redirect statement is

run,
Class_Terminate doesn't get run.

Is this a known problem in ASP classic?



Jul 19 '05 #4
Hi Mark,

Thanks for the assistance, but this isn't the functionality I need. I need
to write a foundation for the site so junior developers can concentrate on
UI issues and not the application. Oh.. but I guess I just thought of a
workaround:

The include file that has the object in it, actual creates an instance of
the object as well (outside of the class definition). So after I create it,
I'll just see if it needed to redirect...

Question though, are classes supposed get destroyed when a redirect happens?
Do they get destroyed by the Class_Terminate isn't called?

Steve
"Mark Schupp" <ms*****@ielear ning.com> wrote in message
news:Or******** ******@TK2MSFTN GP09.phx.gbl...
put the redirect into the include file outside of the class

'class definition here

Dim objClass
Set objClass = new cMyClass

if (objClass.mustr edirect() ) then
Set objClass=Nothin g
response.redire ct("someotherpa ge.asp")
end if

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steve Lutz" <sl***@comcast. net> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Hi, I guess I should clarify, I was trying to generalize the problem..

The object I'm using is going to be used globally through-out the site to ensure user is logged in. To make future pages easier to code, the object Class_initializ e function reads cookies, and attempts to authenticate the user. If unable to, then the user is redirected to an login page. Since it is the class itself doing the redirect, then it isn't possible for the

class
to destroy itself.

<!--#include file="myclass.a sp">
<%
objClass = new cMyClass

' If I get here then the user is logged in.

%>


"Mark Schupp" <ms*****@ielear ning.com> wrote in message
news:un******** ******@TK2MSFTN GP10.phx.gbl...
Try:

Set objClass = new cMyClass
cMyClass.variab le = "Somethign"

if (somecondition) then
Set objClass=Nothin g
response.redire ct("someotherpa ge.asp")
end if
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steve Lutz" <sl***@comcast. net> wrote in message
news:eF******** ******@TK2MSFTN GP12.phx.gbl...
> Hello,
>
> I have a page that creates a class, and then on certain conditions,
> redirects user to another page. The class has a Class_Terminate ()

function
> that saves itself to a database. The class comes from an includes ASP file,
> it isn't a COM object.
>
> Here's my code outline (not actual code for brevity - in otherwords,

there
> may be syntax errors, but that's not the cause of the problem)
>
> <!--#include file="myclass.a sp">
> <%
> objClass = new cMyClass
> cMyClass.variab le = "Somethign"
>
> if (somecondition) then
> response.redire ct("someotherpa ge.asp")
> end if
>
> %>
>
>
> The problem I am having is that if the page does not redirect,

cMyClass's
> Class_Terminate function is run, however, if the redirect statement is run,
> Class_Terminate doesn't get run.
>
> Is this a known problem in ASP classic?
>
>



Jul 19 '05 #5
uh, Steve,

The work-around you came up with is what I was recommending.

As far a the class terminate on re-direction you might try a simpler
mechanism for determining if the terminate method fires or not. Possibly the
database access cannot take place once the page is out of scope. Try writing
out a flag to a file just to see if that is possible. I know that doesn't
resolve the actual issue you have but it may shed light on what is actually
happening.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steve Lutz" <sl***@comcast. net> wrote in message
news:uW******** *****@tk2msftng p13.phx.gbl...
Hi Mark,

Thanks for the assistance, but this isn't the functionality I need. I need
to write a foundation for the site so junior developers can concentrate on
UI issues and not the application. Oh.. but I guess I just thought of a
workaround:

The include file that has the object in it, actual creates an instance of
the object as well (outside of the class definition). So after I create it, I'll just see if it needed to redirect...

Question though, are classes supposed get destroyed when a redirect happens? Do they get destroyed by the Class_Terminate isn't called?

Steve
"Mark Schupp" <ms*****@ielear ning.com> wrote in message
news:Or******** ******@TK2MSFTN GP09.phx.gbl...
put the redirect into the include file outside of the class

'class definition here

Dim objClass
Set objClass = new cMyClass

if (objClass.mustr edirect() ) then
Set objClass=Nothin g
response.redire ct("someotherpa ge.asp")
end if

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steve Lutz" <sl***@comcast. net> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Hi, I guess I should clarify, I was trying to generalize the problem..

The object I'm using is going to be used globally through-out the site to ensure user is logged in. To make future pages easier to code, the object Class_initializ e function reads cookies, and attempts to authenticate the user. If unable to, then the user is redirected to an login page. Since
it
is the class itself doing the redirect, then it isn't possible for the class
to destroy itself.

<!--#include file="myclass.a sp">
<%
objClass = new cMyClass

' If I get here then the user is logged in.

%>


"Mark Schupp" <ms*****@ielear ning.com> wrote in message
news:un******** ******@TK2MSFTN GP10.phx.gbl...
> Try:
>
> Set objClass = new cMyClass
> cMyClass.variab le = "Somethign"
>
> if (somecondition) then
> Set objClass=Nothin g
> response.redire ct("someotherpa ge.asp")
> end if
>
>
> --
> Mark Schupp
> Head of Development
> Integrity eLearning
> www.ielearning.com
>
>
> "Steve Lutz" <sl***@comcast. net> wrote in message
> news:eF******** ******@TK2MSFTN GP12.phx.gbl...
> > Hello,
> >
> > I have a page that creates a class, and then on certain
conditions, > > redirects user to another page. The class has a Class_Terminate ()
function
> > that saves itself to a database. The class comes from an includes

ASP > file,
> > it isn't a COM object.
> >
> > Here's my code outline (not actual code for brevity - in otherwords, there
> > may be syntax errors, but that's not the cause of the problem)
> >
> > <!--#include file="myclass.a sp">
> > <%
> > objClass = new cMyClass
> > cMyClass.variab le = "Somethign"
> >
> > if (somecondition) then
> > response.redire ct("someotherpa ge.asp")
> > end if
> >
> > %>
> >
> >
> > The problem I am having is that if the page does not redirect,
cMyClass's
> > Class_Terminate function is run, however, if the redirect
statement is > run,
> > Class_Terminate doesn't get run.
> >
> > Is this a known problem in ASP classic?
> >
> >
>
>



Jul 19 '05 #6

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

Similar topics

4
2300
by: jsWalter | last post by:
I have an extension Class to Auth and I'm looking for some folks to hammer on it a bit and give feed back. Class: AuthUser - add user (well, Auth does that now, so its gone) - remove user (well, Auth does that now, so its gone) - change password (well, Auth does that now, so its gone) - case sensitive ID match - some DBS don't - limit login attempts (as far as it can go on a browser) - return to original page after login
1
2986
by: Byron | last post by:
I want to take the output of a DOS console application that just streams data to the screen and redirect that output in real time into a C# application that will decode and reformat it for display. I know I could redirect from the DOS application into a file and then read the file, but I want to do this in real-time so I can affect the output of the DOS application and immediately see the results in the C# app. The DOS application is...
2
3184
by: Ivan Lam | last post by:
Hi all, Thanks for reading my post!!! I am facing a problem that I cannot redirect StandartOutput and StandardInput at the same time without closing the executive. Actually, I have a console application named "etm.exe", I would like to call it in my .net (VC) application. What I want to do is when the user type some command in my .net application, I redirect this command
1
1365
by: joseph pattom | last post by:
Hi all i am using <customErrors mode="On" defaultRedirect="ErrorDisplay.aspx"/> in my web.config file and getting redirected to "ErrorDisplay.aspx" in almost all the unhandled exceptions but in case of certain errors its not getting redirected (especialy Acces Violations(object refrence to null exception)). if eny body know the solution pls do reply thx in advance
1
3378
by: girays | last post by:
I have a template class which name is EntityRepository and when I compile this class I get no error. But when I use this class in a main method I get LNK2019 linking error. std::map object is used in EntityRepository template class. You can see the EntityRepository.h and EntityRepository.cpp and main method below: //EntityRepository.h #pragma once #ifndef ENTITYREPOSITORY_H #define ENTITYREPOSITORY_H
2
1725
by: Gary Brown | last post by:
Hi, I have moved some of the implementation of a form into a second file and enclosed it with "partial class ..." VS wants to give the second file its own designer form. How do I prevent that and how do I get rid of the second one? Thanks, Gary
2
1300
Hutt
by: Hutt | last post by:
Hello, I'm fairly new to vb.net and have a question I can't find an answer to. The site I'm working on is complex, but to keep things simple here's the basic problem. I have a site designed with a textbox on the default.aspx page, and I have a class in the App_Code folder (class1.vb). When the class1.vb code runs I need it to read the text from the textbox (i.e. theText = TextBox1.Text), but Visual Studio underlines TextBox1 in blue saying...
1
1550
by: qwikstix | last post by:
I have a right click menu on my page and when I right click but click away instead of choosing an option, I get very weird behavior on the rest of the page. The text input controls are unable to receive focus. It appears that the right click menu is retaining focus even though it has disappeared. Even though I can't see the right click menu, navigating up/down with the keyboard arrows and pressing enter executes options on the now-invisible...
4
3049
by: jeddiki | last post by:
Hi, I am using a dynamic redirect to take vistors to the database stored url as in this part of the script: $sql = "SELECT ad_link FROM adverts WHERE advert_id = $N_ad_id"; $result = mysql_query($sql) or die("could not execute find PRODUCTS query". mysql_error()); $num = mysql_num_rows($result);
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10438
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
10001
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
9042
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
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
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
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.