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.