c# - Refresh an asp.net page on button click -


i need refresh page on button click without increasing hit counter.

  • create class maintain hit counters

    public static class counter {        private static long hit;         public static void hitcounter()        {           hit++;        }         public static long getcounter()        {           return hit;        } } 
  • increment value of counter @ page load event

    protected void page_load(object sender, eventargs e) {     counter.hitcounter(); // call static function of static class counter increment counter value } 
  • redirect page on , display counter value on button click

    protected void button1_click(object sender, eventargs e) {     response.write(request.rawurl.tostring()); // redirect on     response.write("<br /> counter =" + counter.getcounter() ); // display counter value } 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -