Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.