473,395 Members | 1,418 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,395 software developers and data experts.

Redirecting from a class

The software project I'm running uses a lot of helper classes.

I have the habbit of catching errors in any place they occur, but I'm
having troubles with one particular spot.

I didn't code this project to automatically regenerate Sessions when the
website updates. So when the website updates (new DLL, web.config edited
etc.) the sessions are lost, and the users are kicked.

The error is always caught inside my User class (which defines
everything about the logged in user).

When an error occurs in this class, I tried to do:

dim objUtil as new Utility(Utility inherits Page)
objUtil.Redirect("some_page_here.aspx")

But this errors and tells me I cannot redirect like this.

Is there a way of having a flag set inside that class which calls a
function on the calling page allowing it to redirect to the login page
so they can log in again.. and not get an error page telling them to log
in again...
/RT
Nov 19 '05 #1
6 1008
Ryan,

Better yet, why don't you make sure than when you add a new DLL the sessions
are still there by saving them all the time on an SQL database. Read about
SQL Session managment, you'll find the answer there, you are using InProc now
that's why you are losing the Session every time.

Cheers
Al

"Ryan Ternier" wrote:
The software project I'm running uses a lot of helper classes.

I have the habbit of catching errors in any place they occur, but I'm
having troubles with one particular spot.

I didn't code this project to automatically regenerate Sessions when the
website updates. So when the website updates (new DLL, web.config edited
etc.) the sessions are lost, and the users are kicked.

The error is always caught inside my User class (which defines
everything about the logged in user).

When an error occurs in this class, I tried to do:

dim objUtil as new Utility(Utility inherits Page)
objUtil.Redirect("some_page_here.aspx")

But this errors and tells me I cannot redirect like this.

Is there a way of having a flag set inside that class which calls a
function on the calling page allowing it to redirect to the login page
so they can log in again.. and not get an error page telling them to log
in again...
/RT

Nov 19 '05 #2
Al, Thanks for the reply.

We've done that on the new projects. I don't have the resources to
spend that effort on this project. Which is why i'm seeing if this is
viable.

However, regardless on what causes the error, is there a way to set an
event, or flag in a class, that when set, automatically invokes the
calling page to do something?

/RT
Albert Pascual wrote:
Ryan,

Better yet, why don't you make sure than when you add a new DLL the sessions
are still there by saving them all the time on an SQL database. Read about
SQL Session managment, you'll find the answer there, you are using InProc now
that's why you are losing the Session every time.

Cheers
Al

"Ryan Ternier" wrote:

The software project I'm running uses a lot of helper classes.

I have the habbit of catching errors in any place they occur, but I'm
having troubles with one particular spot.

I didn't code this project to automatically regenerate Sessions when the
website updates. So when the website updates (new DLL, web.config edited
etc.) the sessions are lost, and the users are kicked.

The error is always caught inside my User class (which defines
everything about the logged in user).

When an error occurs in this class, I tried to do:

dim objUtil as new Utility(Utility inherits Page)
objUtil.Redirect("some_page_here.aspx")

But this errors and tells me I cannot redirect like this.

Is there a way of having a flag set inside that class which calls a
function on the calling page allowing it to redirect to the login page
so they can log in again.. and not get an error page telling them to log
in again...
/RT

Nov 19 '05 #3
Al, Thanks for the reply.

We've done that on the new projects. I don't have the resources to
spend that effort on this project. Which is why i'm seeing if this is
viable.

However, regardless on what causes the error, is there a way to set an
event, or flag in a class, that when set, automatically invokes the
calling page to do something?

/RT
Albert Pascual wrote:
Ryan,

Better yet, why don't you make sure than when you add a new DLL the sessions
are still there by saving them all the time on an SQL database. Read about
SQL Session managment, you'll find the answer there, you are using InProc now
that's why you are losing the Session every time.

Cheers
Al

"Ryan Ternier" wrote:

The software project I'm running uses a lot of helper classes.

I have the habbit of catching errors in any place they occur, but I'm
having troubles with one particular spot.

I didn't code this project to automatically regenerate Sessions when the
website updates. So when the website updates (new DLL, web.config edited
etc.) the sessions are lost, and the users are kicked.

The error is always caught inside my User class (which defines
everything about the logged in user).

When an error occurs in this class, I tried to do:

dim objUtil as new Utility(Utility inherits Page)
objUtil.Redirect("some_page_here.aspx")

But this errors and tells me I cannot redirect like this.

Is there a way of having a flag set inside that class which calls a
function on the calling page allowing it to redirect to the login page
so they can log in again.. and not get an error page telling them to log
in again...
/RT

Nov 19 '05 #4
Ryan,

What I would do is to right some code on the Global.asax function:
protected void Session_End(Object sender, EventArgs e)
{
Response.Redirect("Login.aspx");
}

Otherwise you can create a user control to check for Session.IsAthenticated
and if false redirect it, however you'll have to add this user control in all
pages.

Hope this helps
Al

"Ryan Ternier" wrote:
Al, Thanks for the reply.

We've done that on the new projects. I don't have the resources to
spend that effort on this project. Which is why i'm seeing if this is
viable.

However, regardless on what causes the error, is there a way to set an
event, or flag in a class, that when set, automatically invokes the
calling page to do something?

/RT
Albert Pascual wrote:
Ryan,

Better yet, why don't you make sure than when you add a new DLL the sessions
are still there by saving them all the time on an SQL database. Read about
SQL Session managment, you'll find the answer there, you are using InProc now
that's why you are losing the Session every time.

Cheers
Al

"Ryan Ternier" wrote:

The software project I'm running uses a lot of helper classes.

I have the habbit of catching errors in any place they occur, but I'm
having troubles with one particular spot.

I didn't code this project to automatically regenerate Sessions when the
website updates. So when the website updates (new DLL, web.config edited
etc.) the sessions are lost, and the users are kicked.

The error is always caught inside my User class (which defines
everything about the logged in user).

When an error occurs in this class, I tried to do:

dim objUtil as new Utility(Utility inherits Page)
objUtil.Redirect("some_page_here.aspx")

But this errors and tells me I cannot redirect like this.

Is there a way of having a flag set inside that class which calls a
function on the calling page allowing it to redirect to the login page
so they can log in again.. and not get an error page telling them to log
in again...
/RT

Nov 19 '05 #5
Since Response is a member of Page class, You can use

objUtil.Response.Redirect("some_page_here.aspx")
HTH

Elton Wang
el********@hotmail.com

"Ryan Ternier" wrote:
The software project I'm running uses a lot of helper classes.

I have the habbit of catching errors in any place they occur, but I'm
having troubles with one particular spot.

I didn't code this project to automatically regenerate Sessions when the
website updates. So when the website updates (new DLL, web.config edited
etc.) the sessions are lost, and the users are kicked.

The error is always caught inside my User class (which defines
everything about the logged in user).

When an error occurs in this class, I tried to do:

dim objUtil as new Utility(Utility inherits Page)
objUtil.Redirect("some_page_here.aspx")

But this errors and tells me I cannot redirect like this.

Is there a way of having a flag set inside that class which calls a
function on the calling page allowing it to redirect to the login page
so they can log in again.. and not get an error page telling them to log
in again...
/RT

Nov 19 '05 #6

"Ryan Ternier" <rt******@icompasstech.com> wrote in message
news:eh**************@TK2MSFTNGP15.phx.gbl...
The software project I'm running uses a lot of helper classes.

I have the habbit of catching errors in any place they occur, but I'm
having troubles with one particular spot.

I didn't code this project to automatically regenerate Sessions when the
website updates. So when the website updates (new DLL, web.config edited
etc.) the sessions are lost, and the users are kicked.

The error is always caught inside my User class (which defines everything
about the logged in user).

When an error occurs in this class, I tried to do:

dim objUtil as new Utility(Utility inherits Page)
objUtil.Redirect("some_page_here.aspx")

But this errors and tells me I cannot redirect like this.

Is there a way of having a flag set inside that class which calls a
function on the calling page allowing it to redirect to the login page so
they can log in again.. and not get an error page telling them to log in
again...
/RT


How about HttpContext.Current.Response.Redirect("Page.aspx") ?

Mythran

Nov 19 '05 #7

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

Similar topics

3
by: nagaraj | last post by:
Hi All, Good Morning, The problem which i am facing is related with IIS 6.0 in Win2K3. The problem: I have a ASP page which redirect a zip file which resides in
3
by: lozd | last post by:
Would appreciate any solutions people could offer for this. Basically I wan't to use a frameset with an aspx page as the contents rather than a htm page and I'd like to be able to redirect the...
15
by: Matt Burland | last post by:
I'm having a problem with redirecting the StandardOutput of a process that I use to run a DOS program in my application. The problem is that I when I start my process (which I do in a separate...
4
by: Greg Smalter | last post by:
Redirecting from page to page within a web project is pretty easy. However, all Redirect methods take strings as arguments, as if you mistype the string, you don't find out until run time that you...
5
by: Markus S. | last post by:
Hello, I have a problem with a DOS EXE that is called by a .Net Winforms application. I need to redirect the console output into a textbox, but this should happen in real time, so when new...
8
by: Morpheus | last post by:
I am trying to test a function that outputs text to the standard output, presumably using a cout call. I do not have access to the source, but need to test the output. Is this possible? I can...
17
by: mansb2002 | last post by:
Hi, We recently moved our webserver from Win2K to Win2003. The application works fine. Only problem is that when user views a report as a PDF, IE does not show it. The following code is used to...
41
by: amygdala | last post by:
Hello all, I have posted a similar question in comp.lang.php in the past, but haven't had any response to it then. I kinda swept the problem under the rug since then. But I would really like to...
1
by: FrankRadio | last post by:
Im trying to catch all errors from my Phyton compiler. for that i'm using this code: This code work great, but i cant pharse the data using the split() function, the parse function comes empty,...
9
by: joe | last post by:
Hello, I have a website set up on our server that is especially for errors. When another website encounters an error, it will redirect to this site with error details in the querystring. The...
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: 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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...

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.