While reading a book, I saw a phrase which distraced me. ("***upon/on entering the door***") And I searched the internet for more information on this usage "upon/on doing". Then I found a very competent comment here As far as I understand, "upon/on doing" make a connection to the main clause but the temporal relationship is not obvious. It could refer to a time before the main clause or after the main clause or even simultaneous with the main clause . What I want to ask you is that: ***What is the different between "on doing"" and "in doing" if both "on doing" and "in doing" refers to some point in the process of doing something?*** ***Can I rewrite the sentence as I have done in the sentence below?*** > 1- ***Upon/on entering*** the castle, he is led to a banquet hall > where he meets the Fisher King and sits down with him for a feast. > > 1a- ***In entering*** the castle, he is led to a banquet hall where he > meets the Fisher King and sits down with him for a feast. > > 2- ***Upon/on purchasing*** the phone, I was assured that this was the > latest and the best model available there. > > 2a- ***In purchasing*** the phone, I was assured that this was the > latest and the best model available there. > > or vice versa: > > 3- ***In running*** out the door, I slipped on the ice outside. > > 3a- ***Upon/on running*** out the door, I slipped on the ice outside. > > 4- ***In studying*** with her, I realized she was deeply interested in > programming. > > 4a- ***Upon/on studying*** with her, I realized she was deeply > interested in programming.