AI OnAI Off
When you run the task manually the job will execute as current user. When it executed by scheduler by default it will be a non authenticated user. The error you got indicated that some page has restricted access ( not just homepage ). I think you need to do impersonate or make that page less restricted. impersontate could be done like this
bool isValidUser = System.Web.Security.Membership.Provider.ValidateUser(username, password);
if (isValidUser)
{
MembershipUser mu = System.Web.Security.Membership.Provider.GetUser(username, true);
EPiServer.Security.PrincipalInfo.CurrentPrincipal = EPiServer.Security.PrincipalInfo.CreatePrincipal(username);
} else
throw new Exception( "Fail on validate user " + username );
We tried impersonating with the username [Epiadmin] but still it throws the exception...
Exception has been thrown by the target of an invocation. [Access was denied to page 15528.]
The Schedule executes properly, when it is invoked "Start Manually", but throws exception as shown below when it is invoked automatically based on the schedule frequency.
Exception has been thrown by the target of an invocation. [Access was denied to page 15528.]
We have tested with all the possible AccessLevel permission to access the HomePage.