This is a common question from trekkers wishing to undertake a trek in Iranian nature.
Basically, it depends on where you are, who your guide is and how likely it is that you come across locals.
Shorts are not allowed for men or women alike. Short sleeves are OK if you are a man and also OK if you are a woman provided women have a long sleeve handy to put over their T shirt and a hat or a head scarf which they put over their head when passing villages or coming into contact with locals. The minimum dress code for women in the urban areas i.e the long overcoat is not compulsory in nature. If you are in very remote areas where coming into contact with locals is highly unlikely then you may wear shorts which cover the knee but remember the exposed parts o your legs will be more prone to bites ans sunburn. Asking your guide is a good option but you need also to consider that some guides are more conservative than others.