  For pulsars in globular clusters, we suggest using observations of the
relativistic time delay of their radiation in the gravitational eld of a
massive body (the Shapiro effect) located close to the line of sight to detect
and identify invisible compact objects and to study the distribution of both
visible and dark matter in globular clusters and various components of the
Galaxy. We have derived the dependences of the event probability on the
Galactic latitude and longitude of sources for two models of the mass
distribution in the Galaxy: the classical Bahcall-Soneira model and the more
recent Dehnen-Binney model. Using three globular clusters (M15, 47 Tuc, Terzan
5) as an example, we show that the ratios of the probability of the events due
to the passages of massive Galactic objects close to the line of sight to the
parameter f2 for pulsars in the globular clusters 47 Tuc and M15 are comparable
to those for close passages of massive objects in the clusters themselves and
are considerably higher than those for the cluster Terzan 5. We have estimated
the rates of such events. We have determined the number of objects near the
line of sight toward the pulsar that can produce a modulation of its pulse
arrival times characteristic of the effect under consideration; the population
of brown dwarfs in the Galactic disk, whose concentration is comparable to that
of the disk stars, has been taken into account for the first time.
