Changes to support PageExecutionContext in Razor

Fixes #1083