Author : Pankaj Tahiliani Technology : ASP.NET Error : The 'MasterPageFile' property can only be set in or before the 'Page_PreInit' event. Solution : At this point, the logical step is to move the line of code into Page_PreInit. Doing this in a real ASPX page avoids the above error (but doesn’t quite actually work). You need to OVERRIDE the PreInit event. Protected Overrides Sub OnPreInit(ByVal e As System.EventArgs) '++++++++++++++++++++++++++... ' Check for login ' if logged in ......