RE: Redirect after 5 seconds only if bolNeedToRedirect=True ?



Hello Jonathan,

There are several ways to redirect the users to another page:

Category A: redirect with html client side code:
http://vancouver-webpages.com/META/FAQ.html#redirect
A1. Location Http header
A2. Refresh meta tag
A3. <body onload="document.location='http://other.org/'">

e.g.

<SCRIPT LANGUAGE="JavaScript">
redirTime = "2";
redirURL = "http://www.microsoft.com";;
function redirTimer() { self.setTimeout("self.location.href =
redirURL;",redirTime); }
</script>
<body onLoad="redirTimer()">

Category B: redirect with server side code:
e.g Response.Redirect("Otherpage.aspx");

To accomplish task that the page is redirected after 5 seconds if the user
logs in, we can do it in this way:

protected void Page_Load(object sender, EventArgs e)
{
if ( // pass login check )
{
Response.Write("<script>redirTimer();</script>"); // call the
javascript to redirect the page
// or
Response.Redirect("Otherpage.aspx"); // redirect with server side
code.
}
}

Hope it helps.

Regards,
Jialiang Ge (jialge@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

.



Relevant Pages

  • RE: Ajax Exception Handling
    ... With the Ajax I don't see anyway other than Redirect or Server.Transfer. ... Microsoft Online Support ... nature are best handled working with a dedicated Microsoft Support Engineer ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Email resent on page refresh
    ... So if I redirect then I do not get duplicate email send. ... event handler will not be executed again. ... Microsoft Online Support ... nature are best handled working with a dedicated Microsoft Support Engineer ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • RE: RoleProvider Capturing Authentication Events
    ... login page) see different pages depend on whether they're unauthenticated ... Because if a user is redirect to login ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Compiling VS2005 project for .NET framework 1.0 or 1.1
    ... redirect the assembly compiled with VS2005 to use .Net CLR1.1: ... I also tried to adding <assemblyBinding> and ... referenced assembly binding version, but the BadImageFormatException dialog ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Forms Authentication - Sudden Redirect Failure on Login
    ... HttpCookie cookie = new HttpCookie ... Yields the problem on ALL platforms, the redirect does not happen. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.aspnet.security)