This is something that should be simple, but there is no straightforward Page.Refresh strangely! This is best way I found to do it…
Response.AddHeader("REFRESH","0");
The zero in the second parameter is how long I would like it to wait before refreshing the page. For example, I used this code on a log out button:
protected void LogOut(object sender, EventArgs e)
{
Session.Abandon();
Response.AddHeader("REFRESH", "0");
}
So when the user clicks “Log Out” the Session is abandoned, and the page is refreshed instantly, sending the user back to the log in page.
I also used this code in another application, where I needed to call a stored procedure in the database and then refresh and redirect the page. It was originally happening too quickly, so I used the following code.
Response.AddHeader("REFRESH", "2;URL=viewinvoice.aspx?tid=" + TID);
So there you go, there are probably a lot more funky things that can be done with Response.AddHeader, but for me, it is the best way to refresh a page I have come across so far!