Stop orCancel aWorkflow programaically
SPSecurity.RunWithElevatedPrivileges (delegate() { using ( SPSite site = new SPSite (SPContext.Current.Site.ID)) { using ( SPWeb web = site.OpenWeb()) { SPWorkflowManager manager = site.WorkflowManager; // ...