473,406 Members | 2,633 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,406 software developers and data experts.

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.asp">
<%
objClass = new cMyClass
cMyClass.variable = "Somethign"

if (somecondition) then
response.redirect("someotherpage.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 2168
Try:

Set objClass = new cMyClass
cMyClass.variable = "Somethign"

if (somecondition) then
Set objClass=Nothing
response.redirect("someotherpage.asp")
end if
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steve Lutz" <sl***@comcast.net> wrote in message
news:eF**************@TK2MSFTNGP12.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.asp">
<%
objClass = new cMyClass
cMyClass.variable = "Somethign"

if (somecondition) then
response.redirect("someotherpage.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_initialize 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.asp">
<%
objClass = new cMyClass

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

%>


"Mark Schupp" <ms*****@ielearning.com> wrote in message
news:un**************@TK2MSFTNGP10.phx.gbl...
Try:

Set objClass = new cMyClass
cMyClass.variable = "Somethign"

if (somecondition) then
Set objClass=Nothing
response.redirect("someotherpage.asp")
end if
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steve Lutz" <sl***@comcast.net> wrote in message
news:eF**************@TK2MSFTNGP12.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.asp">
<%
objClass = new cMyClass
cMyClass.variable = "Somethign"

if (somecondition) then
response.redirect("someotherpage.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.mustredirect() ) then
Set objClass=Nothing
response.redirect("someotherpage.asp")
end if

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steve Lutz" <sl***@comcast.net> wrote in message
news:%2****************@TK2MSFTNGP11.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_initialize 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.asp">
<%
objClass = new cMyClass

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

%>


"Mark Schupp" <ms*****@ielearning.com> wrote in message
news:un**************@TK2MSFTNGP10.phx.gbl...
Try:

Set objClass = new cMyClass
cMyClass.variable = "Somethign"

if (somecondition) then
Set objClass=Nothing
response.redirect("someotherpage.asp")
end if
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steve Lutz" <sl***@comcast.net> wrote in message
news:eF**************@TK2MSFTNGP12.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.asp">
<%
objClass = new cMyClass
cMyClass.variable = "Somethign"

if (somecondition) then
response.redirect("someotherpage.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*****@ielearning.com> wrote in message
news:Or**************@TK2MSFTNGP09.phx.gbl...
put the redirect into the include file outside of the class

'class definition here

Dim objClass
Set objClass = new cMyClass

if (objClass.mustredirect() ) then
Set objClass=Nothing
response.redirect("someotherpage.asp")
end if

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steve Lutz" <sl***@comcast.net> wrote in message
news:%2****************@TK2MSFTNGP11.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_initialize 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.asp">
<%
objClass = new cMyClass

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

%>


"Mark Schupp" <ms*****@ielearning.com> wrote in message
news:un**************@TK2MSFTNGP10.phx.gbl...
Try:

Set objClass = new cMyClass
cMyClass.variable = "Somethign"

if (somecondition) then
Set objClass=Nothing
response.redirect("someotherpage.asp")
end if
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steve Lutz" <sl***@comcast.net> wrote in message
news:eF**************@TK2MSFTNGP12.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.asp">
> <%
> objClass = new cMyClass
> cMyClass.variable = "Somethign"
>
> if (somecondition) then
> response.redirect("someotherpage.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*************@tk2msftngp13.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*****@ielearning.com> wrote in message
news:Or**************@TK2MSFTNGP09.phx.gbl...
put the redirect into the include file outside of the class

'class definition here

Dim objClass
Set objClass = new cMyClass

if (objClass.mustredirect() ) then
Set objClass=Nothing
response.redirect("someotherpage.asp")
end if

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Steve Lutz" <sl***@comcast.net> wrote in message
news:%2****************@TK2MSFTNGP11.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_initialize 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.asp">
<%
objClass = new cMyClass

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

%>


"Mark Schupp" <ms*****@ielearning.com> wrote in message
news:un**************@TK2MSFTNGP10.phx.gbl...
> Try:
>
> Set objClass = new cMyClass
> cMyClass.variable = "Somethign"
>
> if (somecondition) then
> Set objClass=Nothing
> response.redirect("someotherpage.asp")
> end if
>
>
> --
> Mark Schupp
> Head of Development
> Integrity eLearning
> www.ielearning.com
>
>
> "Steve Lutz" <sl***@comcast.net> wrote in message
> news:eF**************@TK2MSFTNGP12.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.asp">
> > <%
> > objClass = new cMyClass
> > cMyClass.variable = "Somethign"
> >
> > if (somecondition) then
> > response.redirect("someotherpage.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
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...
1
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....
2
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...
1
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...
1
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...
2
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...
2
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...
1
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...
4
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
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,...
0
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...
0
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...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.