PrepareEnv: make ReplaceEnv recursive and ASPNET aware