cenyala
10/29/2003 9:03:00 PM
To catch a page error you can always use this:
Private Sub Page_Error(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Error
'' Add some code here to log error if desired
Server.Transfer("CustomErrorPage.aspx")
End Sub
This will handle any errors in your page and redirect to an error
page. Before redirecting you could log the errors somewhere if you
want to see what it is but that way the user gets a nice friendly
page.
"Kenny" <keejh@hotmail.com> wrote in message news:<OGIwehgnDHA.708@TK2MSFTNGP10.phx.gbl>...
> Hi Steph,
>
> Now I am able to redirect the main page to the login page when session
> expired with OnViewStateExpire. What to do if a user click the login button
> (*after 1 min) and hit the session timeout again?
>
> I just wonder why the new session is not created only when the user click
> the login button? and How?
>
> I though by adding Session.Abondon can solve the problem but it seems like
> when I click the Login button (* after 1 min), the program still calling the
> OnViewStateExpire and give me timeout message.
>
> Protected Overrides Sub OnViewStateExpire(ByVal e As EventArgs)
> Session.Abondon()
> RedirectToMobilePage("MobileLogin.aspx?err=timeout")
> End Sub
>
> Currently I set the SessionTimeout to 1 for testing purpose.
>
> tx,
> Kenny
>
>
> "steph" <anonymous@discussions.microsoft.com> wrote in message
> news:090d01c39957$0db6bcb0$a501280a@phx.gbl...
> > In vb:
> >
> > Protected Overrides Sub OnViewStateExpire(ByVal e As
> > EventArgs)
> > ''viewstate has expired
> > Me.RedirectToMobilePage("errorEvent.aspx?ref=viewstate")
> > End Sub
> >
> >
> > >-----Original Message-----
> > >Hi,
> > >
> > >Is there anyone know how to detect and redirect the page
> when hit the error
> > >message as below:-
> > >
> > >Thanks,
> > >Kenny
> > >
> > >Server Error in ''/MobileMM'' Application.
> > >----------------------------------------------------------
> ------------------
> > >----
> > >
> > >The page requires session state that is no longer
> available. Either the
> > >session has expired, the client did not send a valid
> session cookie, or the
> > >session state history size is too small. Try increasing
> the history size or
> > >session expiry limit.
> > >
> > >Description: An unhandled exception occurred during the
> execution of the
> > >current web request. Please review the stack trace for
> more information
> > >about the error and where it originated in the code.
> > >
> > >Exception Details: System.Exception: The page requires
> session state that is
> > >no longer available. Either the session has expired, the
> client did not send
> > >a valid session cookie, or the session state history size
> is too small. Try
> > >increasing the history size or session expiry limit.
> > >
> > >Source Error:
> > >
> > >An unhandled exception was generated during the execution
> of the current web
> > >request. Information regarding the origin and location of
> the exception can
> > >be identified using the exception stack trace below.
> > >
> > >Stack Trace:
> > >
> > >[Exception: The page requires session state that is no
> longer available.
> > >Either the session has expired, the client did not send a
> valid session
> > >cookie, or the session state history size is too small.
> Try increasing the
> > >history size or session expiry limit.]
> > >System.Web.UI.MobileControls.MobilePage.OnViewStateExpire
> (EventArgs e) +45
> > >System.Web.UI.MobileControls.MobilePage.LoadPageStateFromP
> ersistenceMedium()
> > >+315
> > >System.Web.UI.Page.LoadPageViewState() +18
> > >System.Web.UI.Page.ProcessRequestMain() +423
> > >
> > >----------------------------------------------------------
> ------------------
> > >----
> > >Version Information: Microsoft .NET Framework
> Version:1.1.4322.573; ASP.NET
> > >Version:1.1.4322.573
> > >
> > >
> > >.
> > >