As Emily Chappell has noted, men suffer much the same risks in such countries, and in fact [having read other solo women travellers on travels in those regions on modes other than bicycles], arguably encounter more of it. A young Frenchman I travelled with in Egypt suffered the sort of harassment described in the Chappell article, while an English fellow cyclist met in Bangkok showed me the scar on his neck from an Afghan encounter when he rebuffed advances.
I have obviously been far too unattractive to experience such incidents, but on the other hand I have been arrested too many times because I was a male foreigner on my own in places off the tourist track, and men are more likely to be seen as agents for unfriendly powers.
Having acknowledged that, everything said about the general hospitality in those countries is true. I spent a month travelling around Iran on my Bickerton shortly after the New York twin-towers incident, and can confidently agree that the people in Iran were the most hospitable of any other country I have travelled in – surpassing even those in Syria – and that extended across all social “classes” including officialdom as well as the general public. I did still get arrested once while in Iran, in Kermanshah, but that was by a slightly nutty freelance operative, who was told by the local police officer in charge of the district to take me back to where he found me!
Alertness, respect, and genuineness is the best defence against hassles, though everyone will inevitably meet up with those from time to time.