Home > Backend Development > C#.Net Tutorial > .NET prevents refresh from repeated submissions

.NET prevents refresh from repeated submissions

巴扎黑
Release: 2016-12-19 16:43:06
Original
1828 people have browsed it

Code
Public class RefreshServe: System.Web.UI.Page
                                                                                                    Private static ILog log = LogManager.GetLogger(typeof operation (RefreshServe))                                             Private read-only string REFRESH_TICKET_NAME = "__RefreshTicketArray";
                                                                                                                                alone Read string HIDDEN_FIELD_NAME = "__RefreshHiddenField";
         Private read-only string HIDDEN_PAGE_GUID = "__RefreshPageGuid"           ///
                                                                                                                                                                              ​                                                                                                                                          ;
                                                                
                                                                                                                              log.Debug                  .
            ///

//// & lt; Param name = "e" & gt; & lt;/ Param & gt; );
            UpdateRefreshFlag (); Summary & gt; & Private invalidation updateFreshflag () {

# registered pages of the registered page unique logo and return
string PageGuid = SetCurPageGuid (); FreshTiCket (); (cookie.Values.Count> 0)
                                                                                                                                                                log.Debug ("The change of the currently cleared cookie is: " + pageGuid);
                                                                               String submitTime = DateTime.Now.ToString (" "hhmmss.ffffff");                                                                                          ClientScript.RegisterHiddenField(HIDDEN_FIELD_NAME,submitTime);


                                                                                                                                                                          Register HiddenField (HIDDEN_FIELD_NAME,             HiddenField(HIDDEN_FIELD_NAME, submitTime)); pageGuid, submitTime);

                                                                                                                                                                                                                       . I ++) g Log.info ("Biscuits ["+Cookie.Values.getKey (i)+"]:"+Cookie.values ​​[i]);
                                                                                                             private boolean CheckRefreshFlag( ;                                                                               Boolean flag;                                                  = NULL) Sign = Cookie.values ​​[Pageguid] .indexof (getcursubmittime ()) & gt; -1;
Other
signs = true; // Prevent abnormalities, always submit
if (logo)
log.Debugg ("The submission time exists and can be submitted");
                                                                                                   .               Return true; {
#Cookie mode of the region, the return value is the HttpCookie cookie of the cookie;
                         Cookies = new HttpCookie(REFRESH_TICKET_NAME);
                Response.AppendCookie(Cookie ); FRESH_TICKET_NAME]

                                                                                                                                           The number of records existing in is: "+ cookie.Values.Count +" The specific ones are as follows: ");

                                                                                                                      Info("Cookies["+ cookie.Values.GetKey(I)+"]:"+ cookie.Values[I]); /// String submitTime = Request .Params[HIDDEN_FIELD_NAME] == null? "": ToString() of Request.Params [HIDDEN_FIELD_NAME];
                                                                                         ​///
                                 //Set the unique identifier of the page, and use the Guid identifier to distinguish the submission time of each page ! )
                                                                                                                                                                            ToString().
                      log.Debug("SetCurPageGuid "                                                                                                                                                                                   . ID = GetCurPageGuid();

}
                                                                                                                                              ClientScript.RegisterHiddenField(HIDDEN_PAGE_GUID, GUID)
                                                                                                                                                                                                                                          Unique identifier
                                                                                                                                                                                                            HIDDEN_PAGE_GUID] == empty value? "None": ToString() of Request.Params [HIDDEN_PAGE_GUID];
                                                                                               



9999999999999999999999999999999999999999999999999
Required When refreshing the judgment function, the new page only needs to inherit this class, and identify by referencing the attribute IsPageRefreshed that "true means refreshing, false means normal submission", and write the database operation in
If (!IsPageRefreshed)
{
Database operation
}

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template