protected System.Web.UI.WebControls.Button SubmitButton;
protected System.Web.UI.WebControls.Label RefreshID;
private void Page_Load(object sender, System.EventArgs e)
{
if (RefreshID.Text.Length == 0)
{
RefreshID.Text = Session.SessionID+DateTime.Now.Ticks.ToString();
}
}
private void Button1_Click(object sender, System.EventArgs e)
{
string sesToken = (string) Session[FrameworkConst.SYNC_CONTROL_KEYWORD]; string pageToken = RefreshID.Text;
if (sesToken != null && sesToken != pageToken)
{
Response.Write("The Refresh was performed after submit.");
}
else
{
// do your processing here to avoid Refresh trap
Response.Write("The processing is done here. Disabling submit
button so that user can not perform multiple submit.");
Response.Write("But still user can peform Refresh on page.");
}
Session[FrameworkConst.SYNC_CONTROL_KEYWORD] = Session.SessionID+DateTime.Now.Ticks.ToString();
RefreshID.Text = sesToken;
SubmitButton.Enabled = false;