BEIJING — The photos prompted outrage almost as soon as they were posted.

They showed two women inside one of China’s most sacred spaces, the Forbidden City in Beijing, smiling as they showed off a glistening Mercedes-Benz sport utility vehicle.

On Weibo, a Twitterlike site, one of the women bragged about getting exclusive access to the palace, a notoriously congested tourist site, saying she had gone there to “run wild.”

The photos, which were posted on Friday, have set off debate in China about the privileges enjoyed by wealthy families, at a time when President Xi Jinping is trying to persuade the public that he is working to eliminate corruption and to reduce the gap between rich and poor.

Many people denounced the woman, who had frequently boasted about her wealth on social media, as being out of touch. They said she had desecrated the Forbidden City, the former home of emperors, which Mr. Xi has sought to turn into a global symbol of Chinese cultural heritage.