Run the following commands to restart the management agent on an ESXi host.
/etc/init.d/hostd restart
/etc/init.d/vpxa restart
if (!IsPostBack){Session["Check_Page_Refresh"] = DateTime.Now.ToString();}
protected void btn_Click(object sender, EventArgs e){
if (ViewState["Check_Page_Refresh"].ToString() == Session["Check_Page_Refresh"].ToString()){<your main code you want to execute once on button click here>}
}