< summary >
Update identity, Normal commit deletes the time of the commit, and produces the current new time
</Summary >
Private Invalid Updaterefreshflag ()
{
# Region of Cookie mode
The registration page uniquely identifies and returns
String pageguid = Setcurpageguid ();
HttpCookie biscuit = Getrefreshticket ();
if (cookie. Values.count> 0)
{
Cookies. Values.remove (PAGEGUID);
Log. Debug ("The change of the currently purged cookie is:" + pageguid);
}
String submittime = DateTime.Now.ToString ("Hhmmss.fffff");
Save current commit time to hidden field
Clientscript.registerhiddenfield (Hidden_field_name,submittime);
Log. Debug ("Upcoming Time to add: submittime:" + submittime + "GUID:" + pageguid.tostring ());
Cookies. Values.add (Pageguid,submittime);
Log. Debug ("The number of records present in the current cookie in Updaterefreshflag is:" + cookie.) Values.count);
Pairs (INT I = 0; I <cookie. Values.count, i + +)
Log. Info ("cookie [" + cookie. Values.getkey (I) + "]:" + cookies. Values [I]);
Response.appendcookie (biscuit);
#endregion
}
< summary >
Verifying whether to refresh
</Summary >
< return > </return >
Private Boolean Checkrefreshflag ()
{
HttpCookie biscuit = Getrefreshticket ();
String pageguid = Getcurpageguid ();
if (cookie. Values.count> 0)
{
Boolean flag;
if (cookie. Values [pageguid]! = NULL)
Flag = cookie. Values [Pageguid]. IndexOf (Getcursubmittime ()) >-1;
Other
flag = TRUE; Prevent exceptions that can always be committed
if (sign)
Log. Debug ("Commit time exists, can be submitted");
Other
Log. Debug ("Invalid commit Time");
return flag;
}
Returns true;
}
< summary >
Get saved commit time, no new, there is return
</Summary >
< return > </return >
Private HttpCookie Getrefreshticket ()
{
# Region of cookie mode, return value for cookie
of the HttpCookie cookie;
if (request.cookies [refresh_ticket_name] = = NULL)
{
Biscuit = new HttpCookie (refresh_ticket_name);
Response.appendcookie (biscuit);
Log. Debug ("Cookie does not exist, initialize");
}
Otherwise
{
Biscuit = Request.Cookies [Refresh_ticket_name]
Log. Debug ("Read the existing cookie, the cookie currently exists in the number of records:" + cookie.) Values.count + "specific to the following:");
Pairs (INT I = 0; I <cookie. Values.count, i + +)
Log. Info ("cookie [" + cookie. Values.getkey (I) + "]:" + cookies. Values [I]);
}
The returned cookie;
#endregion
}
< summary >
Get Current commit time
</Summary >
< return > </return >
private String Getcursubmittime ()
{
string submittime = Request.params [Hidden_field_name] = = null value? "": Request.params [Hidden_field_name] of ToString ();
Log. Debug ("Execute getcursubmittime:submittime:" + submittime);
return to Submittime;
}
< summary >
Sets the unique identifier of the page, using the GUID identifier to distinguish each page from its own commit time
</Summary >
private String Setcurpageguid ()
{
String GUID;
if (The ispostback! )
{
if (request.params [hidden_page_guid] = = NULL)
{
GUID = ToString () of System.Guid.NewGuid ().
Log. Debug ("Setcurpageguid registered a new identity:" + GUID);
}
Otherwise
GUID = Getcurpageguid ();
}
Otherwise
{
GUID = Getcurpageguid ();
}
Clientscript.registerhiddenfield (Hidden_page_guid,guid)
Returns the GUID;
}
< summary >
Get a unique identifier for the current page
</Summary >
< return > </return >
private String Getcurpageguid ()
{
string pageguid = Request.params [Hidden_page_guid] = = null value? "None": Request.params [Hidden_page_guid] of ToString ();
Log. Debug ("Execute Getcurpageguid () after Page_guid:" + pageguid);
return to Pageguid;
}
}
999999999999999999999999999999999999999999999999
Need to refresh the judgment function The newly page simply inherits the class, by referencing the attribute ispagerefreshed to recognize "true means refresh, false is normal commit", writes the operation of the database in
if (! ispagerefreshed)
{
Database operations
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.