CENTRAL ADMIN

I have created a web application using claims based authentication. I have allowed anonymous access on the default zone. Anonymous policy is set to none in central admin for the default zone. I have added no additional users in 'User Policy'.

SITE COLLECTION LEVEL

Site settings -> Site Permissions -> Anonymous Access -> Entire Web Site.

Now... can anyone tell my why I always get a login prompt when using my custom masterpage? In other words, what in my code-behind could be triggering the login prompt?

 private void addControl(){if (Session[sessionName] == null)
        {
            if (!SPContext.Current.Item.DoesUserHavePermissions(SPBasePermissions.AddAndCustomizePages))
            {                   
                UserControl journeyUserControl = (UserControl)Page.LoadControl(String.Format("~/_controltemplates/BB/{0}Journey.ascx", sessionName) );                                         
                phJourney.Controls.Add(journeyUserControl);                   
            }                
            Session[sessionName] = true;
        }   
}


 private void Localise()
    {
        SPVariationHelper vHelper = new SPVariationHelper(Page);
        uint language;
        uint.TryParse(vHelper.GetDefaultVariationID(), out language);

        if (HttpContext.Current.User.Identity.IsAuthenticated)
        {
            (loginView.FindControl("loginStatus") as LoginStatus).LogoutText = SPUtility.GetLocalizedString("$Resources:BWCore,Logout", "BWCore", language);
        }
        else
        {
            (loginView.FindControl("login") as Label).Text = SPUtility.GetLocalizedString("$Resources:BWCore,Login", "BWCore", language);
            (loginView.FindControl("register") as Label).Text = SPUtility.GetLocalizedString("$Resources:BWCore,Register", "BWCore", language);
        }
    }
link|flag
Are you sure it's the code? Is it working when there isn't any code? Also, is the master page published? That could cause a redirect to login. – Rich Bennema Aug 19 at 12:25
Does it work with the Simple.master?? – Shaneo Aug 26 at 12:51
I have found that if I wrap the functions in SPSecurity.RunWithElevatedPrivileges it seems to work.... does anyone know a reason why this is the case? – Grooverinthesouth Aug 27 at 9:46

Your Answer

 
or
never shown

Know someone who can answer? Share a link to this question via email, twitter, or facebook.

Browse other questions tagged or ask your own question.