Wednesday, December 21, 2011

IE & Sharepoint 2010 UserProfile Cache Issue

When you using Windows Authentication (NTLM + AD) with your sharepoint site you may want to enter credential after you sign out from your site.But it is not easy and somehow imposible when using authentication NTLM and IE .Beacuse after you sign out and try to login again ,automatic login proccess logs you in immediately.

I can explain you two alternative way two prevent automatic log on.
First solution which is my suggested way. Dont use windows authentication . Use Claim Based Authentication (CBA)+ (Forms Based Authentication) FBA with Active Directory (AD) membership.

http://blogs.msdn.com/b/sridhara/archive/2010/01/07/setting-up-fba-claims-in-sharepoint-2010-with-active-directory-membership-provider.aspx
And Second way:
1) Upload jquery 1.4.1.1.js file in one of your library and copy the path.
Edit your v4.master and add fallowing js codes. (Using JQuery)

<script type="text/javascript" src="<<Path of the jquery library >>"></script>
<script type="text/javascript" >
$(document).ready(function(){$("#zz15_ID_Logout").attr("onMenuClick","STSNavigate2(event,'/SitePages/logout.aspx');");});
</script>
 
2) create a new “logout.aspx” page which masterpage is v4.master using Sharepoint Designer

3) add the fallowing code to your new sign out page
<script type="text/javascript">
function _spBodyOnLoad()
{
try
{
   /* Note : this command is support with only IE  */
  document.execCommand("ClearAuthenticationCache",false);
}
  catch (e) { }
  window.location='/_layouts/signout.aspx'; 
}
</script>
4) For testing choose a different machine than sharepoint server and configure your browser Tools->Internet Options->Security->Local Intranet
Click Custom Level and find Logon and change it to “Prompt for user name and password”
And be sure your site not added to trusted zone sites.


Login your site and type your browser’s addres bar
http://[SharepointSiteURL:port]/SitePages/logout.aspx and press enter
Try again to login and see asking your credentials.
when your sharepoint site url does not contain dot “.” that IE suppose that its a Local Intranet site. Thats why we changes the Local Intranet Zone settings to “Prompt for user name and password”

Monday, December 12, 2011

SharePoint Sites Keeps Asking Users to Login

Goto
Computer Configuration | Policies | Windows Settings | Security Settings | Local Policies | Security Options: Network access: Do not allow storage of credentials or .NET Passports for network authentication - set it to Disabled.
As explained in GMPC:
Network access: Do not allow storage of credentials or .NET Passports for network authentication

This security setting determines whether Stored User Names and Passwords saves passwords, credentials, or .NET Passports for later use when it gains domain authentication.

If it is enabled, this setting prevents the Stored User Names and Passwords from storing passwords and credentials.

Note: When configuring this security setting, changes will not take effect until you restart Windows.
For more information about Stored User Names and Passwords, see Stored User Names and Passwords.

Default: Disabled.
Equivalent registry hack: HKLM\System\CurrentControlSet\Control\Lsa\disablecreds
Value type: REG_DWORD
Value: 0 = allow domain credentials  to be stored