'Page' should be available as a property of a any page or user control you make.
if(this.Page.PreviousPage !=null)
{
if(this.Page.Request.UrlReferrer !=null)
{
string referrer = this.Page.Request.UrlReferrer.ToString();
}
}
The reason you should use PreviousPage is because the 404 page shouldn't be the original page the user went to. Sometimes it isn't available though, mostly when you're trying to access it on the first page the user visited when their session was created.