Dart Home | PowerWEB LiveControls for ASP.NET | Custom Development | Reply | PowerWEB LiveControls for ASP.NET Topics | Forums |
Author | Forum: PowerWEB LiveControls for ASP.NET Topic: redirect on page load |
nikesh From: Mumbai, USA Posts: 22 Member Since: 02/03/05 |
posted May 16, 2005 6:58 AM I am trying to trap the session timeout. In this process on page load i have incorporated following code: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Session("UserName") = "" Then Response.Redirect("timeout.aspx") End If End Sub For ex. my timeout in web.config is 2 minutes. So after 2 minutes if i manually refresh the page, page gets redirected to timout.aspx page. However if i click on the livebuttons after 2 minutes, it give Javascript error and does not redirect the page. Javascript error is Line: 506 Char: 3 Error: Syntax Error Code:0 URL: http://website/home.aspx How do i solve this? Nikesh Shah |
nikesh From: Mumbai, USA Posts: 22 Member Since: 02/03/05 |
posted May 16, 2005 7:06 AM Hi Instead of response.redirect i have also tried Livebutton1.BufferedScript.Write("window.navigate('timeout.aspx") but their is no difference. Javascript Error is persistent and page cannot be redirected? Nikesh Shah |
Jeff Cranford![]() From: Rome, NY USA Posts: 586 Member Since: 05/30/01 |
posted May 16, 2005 8:21 AM Noticed a small error in the JavaScript you are using. The rule is, if it is a callback, use the JavaScript technique. If it isn't, use Response.Redirect. Here is your function, rewritten to account for this and to correct the JavaScript. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Session("UserName") = "" Then If LiveButton1.IsCallback = True Then LiveButton1.BufferedScript.Write("window.navigate('newpage.aspx');") Else Response.Redirect("timeout.aspx") End If End If End Sub |
Reply | PowerWEB LiveControls for ASP.NET Topics | Forums |
This site is powered by
![]() |