I've tried to use info from this blog http://world.episerver.com/blogs/Per-Magne-Skuseth/Dates/2013/8/Letting-your-blocks-know-where-they-are/to collect info about containg page for the block being published, but this works only when it gets to the rendering point.
Is there a way of getting the URL of containing page of the block being published if the block is actually contained in the content area?
What about this (code from Dejan's answer)?
var linkRepository = ServiceLocator.Current.GetInstance<ContentSoftLinkRepository>();
var blockLink = (currentBlock as IContent).ContentLink;
var referencingContentLinks = linkRepository.Load(blockLink, true)
link.SoftLinkType == ReferenceType.PageLinkReference &&
.Select(link => link.OwnerContentLink)