c# - How to redirect to another page after a delay -


i have sign-in box in webpage inside updatepanel

<asp:updatepanel runat="server" clientidmode="static" id="upsign" updatemode="conditional">     <contenttemplate>         <div class="dvholder hidoverflow clearfix">             <input id="txtsuser" type="text" name="susername" value="" placeholder="username" runat="server" />         </div>         <div class="dvholder hidoverflow clearfix">             <input id="txtspass" type="password" name="spassword" value="" placeholder="password" runat="server" />         </div>         <div class="dvholder hidoverflow clearfix settextright">             <asp:button id="btnsignin" clientidmode="static" runat="server" text="sign in" onclick="btnsignin_click" />             <asp:label runat="server" text="" id="lblssuccess" clientidmode="static" cssclass="lblmsgsuccess" />         </div>     </contenttemplate> </asp:updatepanel> 

once user validated successfully, want show message , redirect after delay (let's 5 seconds). have following code not redirecting:

public void btnsignin_click(object sender, eventargs e) {     lblssuccess.text = "we found you, redirecting...";     lblssuccess.forecolor = colortranslator.fromhtml("#037203");     session["useisauthenticated"] = "true";      response.appendheader("refresh", "5;url=homepage.aspx"); } 

the message updated page not redirecting reason.

please me resolve issue.

you can write block of javascript delay , redirect page code

public void btnsignin_click(object sender, eventargs e) {     lblssuccess.text = "we found you, redirecting...";     lblssuccess.forecolor = colortranslator.fromhtml("#037203");     session["useisauthenticated"] = "true";      scriptmanager.registerclientscriptblock(this, typeof(page), "redirectjs",     "settimeout(function() { window.location.replace('homepage.aspx') }, 5000);", true); } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -