c# - stop code for X seconds, then continue -


how can stop code few seconds , continue?
have page in navbar admins can enter. if you're not admin, want have alert of

you must admin enter

and user redirected home page. code:

if (session["user"] == null) {      response.write("<script>alert('you must admin page')</script>");      system.threading.thread.sleep(5000);      response.redirect("index.aspx"); } 

but whats happening when press page in navbar waits 5 seconds , redirects me never alerts me anything. why happening?

you can use response.addheader this:

if (session["user"] == null) {    response.write("<script>alert('you must admin page')</script>");    response.addheader("refresh", "5;url=index.aspx"); } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -