I have an ASP.NET application in which I have a function that runs on a button click event, all I need is to have another button which when clicked the function that is running should stop executing. I have added the sample code. Can someone please help me on this? Thanks
protected void btnCreateSites_Click(object sender, EventArgs e) { GenerateSites("CPM"); } static void GenerateSites(string siteName) { //perform some complex operation here } protected void btnStopExecute_Click(object sender, EventArgs e) { //stop the execution of the GenerateSites() function when this button is clicked. }