473,224 Members | 1,688 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,224 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 2161
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...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.