Publishing Delayed Page Versions

Vote:
 

Hi All,

How can i find the event Instance_PublishingPage(object sender, PageEventArgs e) in Global.asax.cs was called by scheduler or Manual Save and Publish?

Thanks in Advance.

Regards

Saran

#60123
Jul 18, 2012 18:14
Vote:
 

I'm not sure if there's an elegant way to do it, but you could use the fact that the scheduler doesn't run in context of a user on the site. That is, you can check if there's a logged in user in the given context. Something like this ought to do the trick:

if(PrincipalInfo.CurrentPrincipal == null || PrincipalInfo.CurrentPrincipal == PrincipalInfo.AnonymousPrincipal)
{
  //Assume scheduled job, or at least not a "real life editor"
}

    

Doing so won't say for certain that it was the scheduled job that triggered the event, but it will tell you that it wasn't an authenticated editor which I'm guessing is good enough.

#60132
Jul 19, 2012 13:13
Vote:
 

Thanks for your reply Joel, I got the solution for it before Actually it should be like this below:

if(HttpContext.Current != null && HttpContext.Current.Request.RawUrl.Contains("EditPanel.aspx"))

{

//Manual Save and Publish

}

else

{

//Publish by the Scheduler

}

#60137
Jul 19, 2012 17:06
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.