We report on the magnetoresistance of a two-dimensional electron gas subjec
ted to an abrupt magnetic field gradient arising from a ferromagnetic strip
e fabricated at its surface. A sharp resistance resonance effect is observe
d at B-p due to the formation of two types of magnetic edge states that dri
ft in opposite directions perpendicular to the magnetic field gradient for
B < B-p and B > B-p. A semiclassical drift-diffusion model gives a good des
cription of the effects of the magnetic confinement on both the diagonal an
d off-diagonal components of the resistivity tensor.