Step 1: Start with what causes a viral ulcer here.
The typical viral cause of shallow esophageal ulcers is herpes simplex virus, and the question is asking where in the ulcer the tissue sample should be taken from to catch the virus on biopsy.
Step 2: Follow the virus to its target cell.
HSV specifically invades the squamous cells lining the esophagus, and these infected cells survive at the rim of the ulcer, not in its floor. Under the microscope, pathologists look for ballooned cells, multinucleation and Cowdry A inclusions, and these changes are concentrated at the margin.
Step 3: Explain why sampling elsewhere fails.
By the time an ulcer has formed, its base is mostly dead tissue and inflammatory exudate. Taking a sample from there mostly returns debris and misses the actively infected cells. The surrounding mucosa away from the ulcer edge, and any thickened (indurated) patch, are not the site of active viral replication either.
Step 4: Add the contrast case for completeness.
It helps to remember that CMV esophagitis behaves the opposite way: CMV infects the deeper endothelial and connective tissue cells found in the ulcer base, so CMV cases are biopsied at the base. But a plain viral ulcer question, as asked here, is testing the HSV rule.
Step 5: Conclude.
Sampling the edge of the ulcer gives the best chance of finding the diagnostic viral change.
$\boxed{\text{Edges}}$