RadAjax for ASP.NET

Redirecting to another page Send comments on this topic.
How-to > Redirecting to another page

Glossary Item Box

Telerik RadAjax supports two kinds of redirection:

  • Response.Redirect()  - the standard ASP.NET means of redirection.
  • generating JavaScript that sets window.location.href.

Redirecting on the client (JavaScript window.location.href)

RadAjaxManager and RadAjaxPanel also support the Redirect() method, which in essence adds a short javascript to be evaluated after the AJAX request. The javascript code uses the window.location.href property to navigate to a new URL.

C# Copy Code
RadAjaxManager1.Redirect("http://www.google.com/");
VB.NET Copy Code
RadAjaxManager1.Redirect("http://www.google.com/")
or
C# Copy Code
RadAjaxPanel1.Redirect("http://www.google.com/");
VB.NET Copy Code
RadAjaxPanel1.Redirect("http://www.google.com/")
Redirect when session times out.

When using authentication for your page and the session expires you need to add the following code to the Page_Init event of the Login.aspx page:

C# Copy Code
protected void Page_Init(object sender, EventArgs e)
   {
       Response.RedirectLocation = Request.Url.ToString();
   }
This way clicking on ajaxified control when the session has expired will lead to the expected behavior of redirecting to the login page.