Available data on the association between antihypertensive drugs and cancer are characterized by a few years follow-up. Our aim has been to evaluate the association between long-term exposure to antihypertensive drugs and the risk of cancer occurrence. Using the healthcare utilization databases of the Lombardy region (Italy), individuals aged 40-85 years who had no previous history of cancer and were newly dispensed with at least one antihypertensive drug from the major drug classes between 2009 and 2011 were followed from the first drug dispensation to December 31, 2020. Data were analyzed according to the first drug used and the intention to treat principle, but also via an "as treated" approach, that is, by considering changes of and exposure to drugs during follow-up. The association between the duration of exposure to each drug class and the risk of cancer occurrence was evaluated using the adjusted Cox regression models. The study cohort included 338 910 new drug users (median age, 59 years; 49.5% males). During a median follow-up of 10.2 years, 36 556 cancers occurred. There was no consistent significant association between the risk of cancer occurrence and angiotensin-converting-enzyme inhibitors, angiotensin-receptor blockers, or thiazides. A progressive, weak increase in cancer occurrence was associated with progressive exposure to calcium channel blockers and, limited to long-term exposure, to beta-blockers. A modest progressive increase in risk was observed also for thiazide-like and loop diuretics in the as treated, although not in the intention to treat approach. Long-term evaluation of exposure to antihypertensive drugs did not show consistent associations between thiazides, angiotensin-receptor blockers, or angiotensin-converting-enzyme inhibitors and the risk of cancer occurrence. A weak association was observed between cancer and the duration of exposure to calcium channel blockers and beta-blockers.