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

We have web application with SQL ASP Membership Provider, Role manager and profile provider. This web application has both authentication methods: NTLM and forms. Everything works fine.

Problem occurs when we extend our web application and configure it with form auth only. When I try to access page with webpart, which makes use of ASP profiles, I get 403 forbidden. The same webpart, accessed by forms authentication from our original web app (not extended), everything works fine.

Here is method I use to retrieve profile property:

public static string GetCitizenId(string login)
{
    LoggingService.LogInfo(String.Format("Getting citizen Id for login '{0}'", login));
    string citizenId = null;

    if (login != null)
    {
        LoggingService.LogInfo("Login exists");
        SPSecurity.RunWithElevatedPrivileges(delegate
        {
            var userProfile = ProfileBase.Create(login);

            LoggingService.LogInfo("Does profile exist? " + (userProfile != null));
            LoggingService.LogInfo("Username from profile: " + userProfile.UserName);


            //string crmId = userProfile["CRMId"] as string;
            string crmId = (string)userProfile.GetPropertyValue("CRMId");

            LoggingService.LogInfo(String.Format("CRMId is '{0}'", crmId)); // <<-- THIS LINE IS NEVER REACHED! NO LOG ENTRY!

            if (!string.IsNullOrEmpty(crmId))
                citizenId = crmId;
        });
    }
    else
    {
        LoggingService.LogError("Login is null");
    }
    LoggingService.LogInfo(string.Format("Citizen id is: '{0}'", citizenId));

    return citizenId;
}

We log messages to ULS and I noticed that when trying to get citizen ID from extended WebApp, the line which logs citizen ID to ULS is never called. So the problem probably exist in one line above. When I debug my code, debugger stops at this line:

string crmId = (string)userProfile.GetPropertyValue("CRMId");

with exception:

Access to the path 'C:\inetpub\wwwroot\wss\VirtualDirectories\5001\App_Data' is denied.
share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

It turned out that extended web application didnt have default profile provider configured in web.config. After manually setting profile provider for extended application, everything started to work.

share|improve this answer
    
I'm having the same issue. I'm trying Membersip.GetUser(). Not sure why it's denying me access. Any ideas? –  Pathachiever11 Sep 10 '12 at 19:22
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.