I have a custom person.aspx that is currently used by my mysite application and I wrote a code that checks if the ProfilePropertyLoader control returns a null value of the profile page being viewed and redirects it to a page, but something is wrong because I keep getting the User Not Found error and the page does not redirect. It seems that the loading of the ProfilePropertyLoader is being executed first before the Page_Load. I have also tried on Init and PreRender but it does not change the result. :)
public void Page_Load(object sender, EventArgs e){
try
{
UserProfile thisPageUserProfile = ProfilePropertyLoader.GetPageProfile(this.Page);
if(thisPageUserProfile == null){
Response.Redirect("~/customprofileerrorpage.aspx");
}
}
catch(Exception ex)
{
Response.Redirect("~/default.aspx");
}
}
thanks for the help in advance.