none
Getting SPWeb.CurrentUser as null with Windows Authentication (AD), when configured for Claims Authentication RRS feed

  • Question

  • Hi All,

    We recently migrated to SP 2013 from SP 2010. We are using most of the OOB features, with a few custom code. We have implemented a custom ASP.NET Membership Provider that authenticates against a web service. This was working fine on SP 2010.

    The entire code base was migrated to SP 2013 (with .net fw 4.5, etc) and any issues Compile / Runtime were fixed. However, we are stuck at one bug, which seems to be occuring only while trying to login with Windows Authentication. When a user tries to login with Forms Authentication, the error is never noticed.

    Scenrio: Login as Windows Authentiction.
    Result: The user is signed into the system and is authenticated against the AD. For random page loads - it throws access denied (even though he is a site collection admin). While attaching a debugger, we found that, at times the SPWeb.CurrentUser is null (weird). At the same time, the HttpContext.Current.Request.IsAuthenticated returns true. Which means the User is Authenticated, but not available in the SPWeb.CurrentUser object. 

    Attached are couple of ULS Logs that we found. The line which says IsAuthenticated=True, UserIdentityName=, ClaimsCount=0 is a little disturbing. Can you please let me know what is happening here? I am not able to access the root site (http://win2012d2:1234/) however, i am able to access (http://win2012d2:1234/SitePages/Home.aspx) just fine, without any issues.

    Please note, this error is only when the user is logged into sharepoint as a windows user. The forms user faces no such issues.

    ULS Logs:
    Name=Request (GET:http://win2012d2:1234/)
    Non-OAuth request. IsAuthenticated=True, UserIdentityName=, ClaimsCount=0
    Application error when access /, Error=Exception of type 'System.ArgumentException' was thrown.  Parameter name: encodedValue  
     at Microsoft.SharePoint.Administration.Claims.SPClaimEncodingManager.DecodeClaimFromFormsSuffix(String encodedValue)    
     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(IClaimsIdentity claimsIdentity, String encodedIdentityClaimSuffix)    
     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(String encodedIdentityClaimSuffix)    
     at Microsoft.SharePoint.Utilities.SPUtility.GetFullUserKeyFromLoginName(String loginName)    
     at Microsoft.SharePoint.ApplicationRuntime.SPHeaderManager.AddIsapiHeaders(HttpContext context, String encodedUrl, NameValueCollection headers)    
     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PreRequestExecuteAppHandler(Object oSender, EventArgs ea)    
     at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    Getting Error Message for Exception System.ArgumentException: Exception of type 'System.ArgumentException' was thrown.  Parameter name: encodedValue    
     at Microsoft.SharePoint.Administration.Claims.SPClaimEncodingManager.DecodeClaimFromFormsSuffix(String encodedValue)    
     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(IClaimsIdentity claimsIdentity, String encodedIdentityClaimSuffix)    
     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(String encodedIdentityClaimSuffix)    
     at Microsoft.SharePoint.Utilities.SPUtility.GetFullUserKeyFromLoginName(String loginName)    
     at Microsoft.SharePoint.ApplicationRuntime.SPHeaderManager.AddIsapiHeaders(HttpContext context, String encodedUrl, NameValueCollection headers)    
     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PreRequestExecuteAppHandler(Object oSender, EventArgs ea)    
     at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    [Forced due to logging gap, Original Level: Verbose] Looking up {0} site {1} in the farm {2} 
    Unknown SPRequest error occurred. More information: 0x80070005

    SPRequest.GetPageListId: UserPrincipalName=, AppPrincipalName= ,bstrUrl=http://win2012d2:1234/
    System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)), StackTrace:   
     at Microsoft.SharePoint.SPContext.get_ListId()    
     at Microsoft.SharePoint.SPContext.get_List()    
     at Microsoft.SharePoint.WebControls.ScriptLink.InitJs_Register(Page page)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast, Boolean ignoreFileNotFound)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(String uiVersion, Control ctrl, Page page, String name, Boolean localizable, Boolean defer)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer)    
     at Microsoft.SharePoint.WebControls.ScriptLink.GetOnDemandScriptKey(String strKey, String strFile, Boolean registerDependencies, Control ctrl, Page page)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Page page, String strFile, Boolean localizable)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast, Boolean ignoreFileNotFound)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable)    
     at Microsoft.SharePoint.WebControls.ScriptLink.OnLoad(EventArgs e)    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
     at System.Web.UI.Page.ProcessRequest()    
     at System.Web.UI.Page.ProcessRequest(HttpContext context)    
     at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)    
     at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)    
     at System.Web.HttpServerUtility.Transfer(String path)    
     at Microsoft.SharePoint.Utilities.SPUtility.TransferToErrorPage(String message, String linkText, String linkUrl)    
     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorHandler(HttpApplication app, Boolean errorIsOnErrorPage)    
     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorAppHandler(Object oSender, EventArgs ea)    
     at System.EventHandler.Invoke(Object sender, EventArgs e)    
     at System.Web.HttpApplication.RaiseOnError()    
     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)    
     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)    
     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)    
     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
     
    SPRequest.OpenWeb: UserPrincipalName=, AppPrincipalName= ,bstrUrl=http://win2012d2:1234/
    System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)), StackTrace:   
     at Microsoft.SharePoint.SPWeb.InitWeb()    
     at Microsoft.SharePoint.SPWeb.get_WebTemplateConfiguration()    
     at Microsoft.SharePoint.WebControls.ScriptLink.InitJs_Register(Page page)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast, Boolean ignoreFileNotFound)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(String uiVersion, Control ctrl, Page page, String name, Boolean localizable, Boolean defer)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer)    
     at Microsoft.SharePoint.WebControls.ScriptLink.GetOnDemandScriptKey(String strKey, String strFile, Boolean registerDependencies, Control ctrl, Page page)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Page page, String strFile, Boolean localizable)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast, Boolean ignoreFileNotFound)    
     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag)    
     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable)    
     at Microsoft.SharePoint.WebControls.ScriptLink.OnLoad(EventArgs e)    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Control.LoadRecursive()    
     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
     at System.Web.UI.Page.ProcessRequest()    
     at System.Web.UI.Page.ProcessRequest(HttpContext context)    
     at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)    
     at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)    
     at System.Web.HttpServerUtility.Transfer(String path)    
     at Microsoft.SharePoint.Utilities.SPUtility.TransferToErrorPage(String message, String linkText, String linkUrl)    
     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorHandler(HttpApplication app, Boolean errorIsOnErrorPage)    
     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorAppHandler(Object oSender, EventArgs ea)    
     at System.EventHandler.Invoke(Object sender, EventArgs e)    
     at System.Web.HttpApplication.RaiseOnError()    
     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)    
     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)    
     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)    
     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)

    Hanif

    Monday, April 21, 2014 11:50 AM

All replies

  • Hi,

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Thanks 

    Patrick Liang

    Forum Support

    Please remember to mark the replies as answers if they
    help and unmark them if they provide no help. If you have feedback for TechNet
    Subscriber Support, contact
    tnmff@microsoft.com



    Patrick Liang
    TechNet Community Support

    Tuesday, April 22, 2014 2:17 AM
    Moderator
  • Hi,

    Do you have anonymous access enabled? As I can remember, for anonymous user the currentuser is null. 


    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

    Tuesday, April 22, 2014 2:54 AM
  • Hi Hanif,

    if should adding access for anonymous as Sohel suggested already being tried and issue persist, please ensure that all the username that used in sharepoint 2013, are available and have the permissions.

    please have a try to disable the loop back check, and then check also if you have a elevated privilleges scenario in your windows authentication method.


    Regards,
    Aries
    Microsoft Online Community Support


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Tuesday, April 22, 2014 5:23 AM
  • Thanks Aries, Sohel

    I checked thoroughly and see that Anonymous authentication is disabled. Also, even if the user is a site collection administrator, this issue persists. On close inspection, I see that its not the SPWeb.CurrentUser which is null. I'm getting the SPWeb object using SPContext.Current.Web. The SPContext.Current.Web which is null. This is happening inside a layouts page WebMethod, which we are using specifically for jQuery Ajax calls.

    The page Ajax.aspx has a WebMethod called GetNavigationPermissions()

    //Code We are using

    [WebMethod]
    public static string GetNavigationPermissions()
    {
    List<KeyValue> pagelist = new List<KeyValue>();
    try
    {
    SPWeb web = SPContext.Current.Web; //This is null too
    string CurrentUser = web.CurrentUser.Name; //Error here

    ..Perform some action
    }
    catch (Exception ex)
    {

    }

    var jsonSerialiser = new JavaScriptSerializer();
    return jsonSerialiser.Serialize(pagelist);

    }

    The error occurs when we try to access SPContext.Current.Web. Also, the ULS logs shows the errors I posted previously.

    Surprisingly this was working fine in SP2010 (Both Windows / Forms Auth) and is also working fine for SP2013 Forms Auth user, but failing for windows authentication user.


    Hanif


    Tuesday, April 22, 2014 12:46 PM
  • Hi,

    Page methods are not enabled by default in SharePoint master page in SharePoint 2013. Have you enabled the page methods from master page as shown below:

    <asp:ScriptManager ID="ScriptManager" runat="server" EnablePageMethods="True" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true" />

    But I would recommend, if possible, replace the page methods with some wcf service call.


    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

    Wednesday, April 23, 2014 12:32 AM
  • I had a weird issue that Aries' problem fixed so I just want to let everyone know. I did a Run As for IE11 so I could test out some SharePoint 2013 functionality as another user. The Run As worked fine but once I switched IE back to my current user it kept trying to log in as the other user. I tried clearing cache, browser changes etc etc. It turns out I had setup my 2013 Dev Box using the Disable Loop Back technique and once I removed that from the registry, the site worked fine. I am not an admin so I am not sure if they are related but I wanted to put it out there in case someone had a similar issue. 
    • Edited by Cephusj Wednesday, April 23, 2014 2:42 PM
    Wednesday, April 23, 2014 2:42 PM
  • Thanks Sohel. I did add that, but the issue persists. Funny part is - it works perfectly when logged in as a Forms Auth user.

    I tries the Run as Admin option Cephusj mentioned, but seems to make no change either.

    Loop back check is disabled, so nothing with that.


    Hanif

    Wednesday, April 23, 2014 3:13 PM
  • Hi cpehusj,

    By default IE has settings that you can modify to change the auto-login behaviour:

    1. Browse the site in IE
    2. Then go to Tools => 'Internet Options' => 'Security' tab.
    3. Check which zone is selected (Internet, Local Intranet or Trusted sites). By default for 'Local Intranet' zone, IE enable auto login. Click on 'Custom Level' button and at the very bottom of the 'settings' section modify the radio button from 'Automatic logon only in Intranet Zone' to 'Prompt for user name and password'
    4. Now you will be prompted for user/name password always. You can revert back the settings again to 'auto login' once you done testing.

    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

    Thursday, April 24, 2014 12:26 AM
  • Hi,

    Are you using any custom login page? Can you please take a look in SharePoint ULS log when you try to login using windows credentails? There might be some warning/error info in the log file.

    Also you can't browse 'http://win2012d2:1234/SitePages/Home.aspx' but 'http://win2012d2:1234/'. Apparently they are the same site. What is the default url of the site 'http://win2012d2:1234'?


    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

    Thursday, April 24, 2014 12:46 AM
  • Thanks Sohel,

    Yes, we are using a custom login page. But the look and feel is very similar to the OOB login page (with 1 dropdown to select windows or forms). On selecting windows, we are redirecting the user to 

    "/_windows/Default.aspx?Source=/SitePages/Home.aspx&ReturnUrl="

    so that SharePoint takes care of windows authentication. Maybe something else needs to be done here?

    For Forms, we are using a asp login control and validating with our custom membership provider - which calls another web service to validate the credentials. Once authenticated, the user is sent to the /SitePages/Home.aspx

    One more thing i noticed. I am not able to perform a clean sign-out when using windows authentication. On using the Sign Out link from the Welcome Menu, it redirects me to "/" and throws an error. Again, this happens only with windows authentication. For forms signout, it gracefully takes me back to the sign in page, allowing me to choose either windows or forms authentication. ULS logs for signout errors :

    - Name=Timer Job MySite-Instantiation-Interactive-Request-Queue
    - <LogTimerJobInstance> Starting timer My Site Instantiation Interactive Request Queue (e94a6caa-b0f5-4897-b489-585ca50c7803) for web application: G2Worfklow SharePoint Site - 1234. Function: MySiteInstantiationJob:Execute
    - <LogTimerJobInstance> Finishing on timer My Site Instantiation Interactive Request Queue (e94a6caa-b0f5-4897-b489-585ca50c7803) for web application: G2Worfklow SharePoint Site - 1234.  Function: MySiteInstantiationJob:Execute
    - Leaving Monitored Scope (Timer Job MySite-Instantiation-Interactive-Request-Queue). Execution Time=3.56029886479986
    - Name=Request (GET:http://win2012d2:1234/)
    - Non-OAuth request. IsAuthenticated=True, UserIdentityName=, ClaimsCount=0
    - Application error when access /, Error=Exception of type 'System.ArgumentException' was thrown.  Parameter name: encodedValue   at Microsoft.SharePoint.Administration.Claims.SPClaimEncodingManager.DecodeClaimFromFormsSuffix(String encodedValue)     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(String encodedIdentityClaimSuffix)     at Microsoft.SharePoint.ApplicationRuntime.SPHeaderManager.AddIsapiHeaders(HttpContext context, String encodedUrl, NameValueCollection headers)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PreRequestExecuteAppHandler(Object oSender, EventArgs ea)     at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    - System.ArgumentException: Exception of type 'System.ArgumentException' was thrown.  Parameter name: encodedValue    at Microsoft.SharePoint.Administration.Claims.SPClaimEncodingManager.DecodeClaimFromFormsSuffix(String encodedValue)     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(String encodedIdentityClaimSuffix)     at Microsoft.SharePoint.ApplicationRuntime.SPHeaderManager.AddIsapiHeaders(HttpContext context, String encodedUrl, NameValueCollection headers)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PreRequestExecuteAppHandler(Object oSender, EventArgs ea)     at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    - Getting Error Message for Exception System.ArgumentException: Exception of type 'System.ArgumentException' was thrown.  Parameter name: encodedValue     at Microsoft.SharePoint.Administration.Claims.SPClaimEncodingManager.DecodeClaimFromFormsSuffix(String encodedValue)     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(String encodedIdentityClaimSuffix)     at Microsoft.SharePoint.ApplicationRuntime.SPHeaderManager.AddIsapiHeaders(HttpContext context, String encodedUrl, NameValueCollection headers)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PreRequestExecuteAppHandler(Object oSender, EventArgs ea)     at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    - Site=/
    - Unknown SPRequest error occurred. More information: 0x80070005
    - SPRequest.GetPageListId: UserPrincipalName=, AppPrincipalName= ,bstrUrl=http://win2012d2:1234/
    - System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)), StackTrace:    at Microsoft.SharePoint.SPContext.get_ListId()     at Microsoft.SharePoint.SPContext.get_List()     at Microsoft.SharePoint.WebControls.ScriptLink.InitJs_Register(Page page)     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast, Boolean ignoreFileNotFound)     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag)     at Microsoft.SharePoint.WebControls.ScriptLink.Register(String uiVersion, Control ctrl, Page page, String name, Boolean localizable, Boolean defer)     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer)     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable)     at Microsoft.SharePoint.WebControls.ScriptLink.GetOnDemandScriptKey(String strKey, String strFile, Boolean registerDependencies, Control ctrl, Page page)     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable)     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterStringsJsIfNecessary(String strFile, Page page)     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast, Boolean ignoreFileNotFound)     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag)     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable)     at Microsoft.SharePoint.WebControls.ScriptLink.OnLoad(EventArgs e)     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)     at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)     at System.Web.HttpServerUtility.Transfer(String path)     at Microsoft.SharePoint.Utilities.SPUtility.TransferToErrorPage(String message, String linkText, String linkUrl)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorHandler(HttpApplication app, Boolean errorIsOnErrorPage)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorAppHandler(Object oSender, EventArgs ea)     at System.EventHandler.Invoke(Object sender, EventArgs e)     at System.Web.HttpApplication.RaiseOnError()     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
    - Unknown SPRequest error occurred. More information: 0x80070005
    - SPRequest.OpenWeb: UserPrincipalName=, AppPrincipalName= ,bstrUrl=http://win2012d2:1234/
    - System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)), StackTrace:    at Microsoft.SharePoint.SPWeb.InitWeb()     at Microsoft.SharePoint.SPWeb.get_WebTemplateConfiguration()     at Microsoft.SharePoint.WebControls.ScriptLink.InitJs_Register(Page page)     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast, Boolean ignoreFileNotFound)     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag)     at Microsoft.SharePoint.WebControls.ScriptLink.Register(String uiVersion, Control ctrl, Page page, String name, Boolean localizable, Boolean defer)     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer)     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable)     at Microsoft.SharePoint.WebControls.ScriptLink.GetOnDemandScriptKey(String strKey, String strFile, Boolean registerDependencies, Control ctrl, Page page)     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable)     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterStringsJsIfNecessary(String strFile, Page page)     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, Boolean injectNoDefer, Boolean controlRegistration, Boolean loadInlineLast, Boolean ignoreFileNotFound)     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion, String ctag)     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Control ctrl, Page page, String strKey, String strFile, Boolean localizable)     at Microsoft.SharePoint.WebControls.ScriptLink.OnLoad(EventArgs e)     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)     at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)     at System.Web.HttpServerUtility.Transfer(String path)     at Microsoft.SharePoint.Utilities.SPUtility.TransferToErrorPage(String message, String linkText, String linkUrl)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorHandler(HttpApplication app, Boolean errorIsOnErrorPage)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorAppHandler(Object oSender, EventArgs ea)     at System.EventHandler.Invoke(Object sender, EventArgs e)     at System.Web.HttpApplication.RaiseOnError()     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
    - Unknown SPRequest error occurred. More information: 0x80070005
    - SPRequest.OpenWeb: UserPrincipalName=, AppPrincipalName= ,bstrUrl=http://win2012d2:1234/
    - System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)), StackTrace:    at Microsoft.SharePoint.SPWeb.InitWeb()     at Microsoft.SharePoint.SPWeb.get_EnableMinimalDownload()     at Microsoft.SharePoint.WebControls.DeltaPage.RenderToBase(HtmlTextWriter writer)     at Microsoft.SharePoint.WebControls.DeltaPage.Render(HtmlTextWriter writer)     at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)     at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)     at System.Web.HttpServerUtility.Transfer(String path)     at Microsoft.SharePoint.Utilities.SPUtility.TransferToErrorPage(String message, String linkText, String linkUrl)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorHandler(HttpApplication app, Boolean errorIsOnErrorPage)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorAppHandler(Object oSender, EventArgs ea)     at System.EventHandler.Invoke(Object sender, EventArgs e)     at System.Web.HttpApplication.RaiseOnError()     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
    - Unknown SPRequest error occurred. More information: 0x80070005
    - SPRequest.OpenWeb: UserPrincipalName=, AppPrincipalName= ,bstrUrl=http://win2012d2:1234/
    - System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)), StackTrace:    at Microsoft.SharePoint.SPWeb.InitWeb()     at Microsoft.SharePoint.SPWeb.get_EnableMinimalDownload()     at Microsoft.SharePoint.WebControls.DeltaPage.RenderToBase(HtmlTextWriter writer)     at Microsoft.SharePoint.WebControls.DeltaPage.Render(HtmlTextWriter writer)     at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)     at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)     at System.Web.HttpServerUtility.Transfer(String path)     at Microsoft.SharePoint.Utilities.SPUtility.TransferToErrorPage(String message, String linkText, String linkUrl)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorHandler(HttpApplication app, Boolean errorIsOnErrorPage)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorAppHandler(Object oSender, EventArgs ea)     at System.EventHandler.Invoke(Object sender, EventArgs e)     at System.Web.HttpApplication.RaiseOnError()     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
    - Leaving Monitored Scope (Request (GET:http://win2012d2:1234/)). Execution Time=39.5931605832585



    Hanif

    Thursday, April 24, 2014 3:38 PM
  • Hi,

    My understanding is there something wrong in the login selection page. Even if you redirect to windows login page, the default SharePoint login selection page has some logic, that you may need to replicate in your custom login selection page. I used reflector to see the code in the SharePoint login selector page (Microsoft.SharePoint.IdentityModel.Pages.MultiLogonPage) and noticed the page should inherit from 'IdentityModelSignInPageBase'. Also the page sets teh Thread Culture from request web. So please take a look in the login selection page and replicate the code in your custom login page. Another thing you can do to narrow down the problem. If you don't use custom login page (just configure Asp.net Membership provider), do you still see the same problem? If not then surely the problem is with your custom login page - maybe something changed in SharePoint 2013. If you find the similar problem with the SharePoint default login page then the problem is somewhere else.


    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

    Monday, April 28, 2014 1:54 AM
  • Thanks Sohel,

    But this does not solve the problem as well. Even with the default login page the issue persists.

    I tried with fresh installing SharePoint 2013 on another server, and used only the custom membership provider along with NTLM authentication, used the default sign-in page. The same issue, with AD users. Not only that, the logout issue also persists - Sign in as windows authentication, and perform a sign out from welcome menu - you get redirect to the "/" and get an error occured. - Logs say the same thing. 

    I assume this is some kind of a serious bug within SharePoint itself. I have anonymous disabled since day 1, there is no way for it to get the IsAuthenticated=true and UserIdentityName=, ClaimsCount=0.



    Hanif

    Monday, May 5, 2014 8:49 AM
  • Hi Hanif,

    did you resolved this weird issue? I'm facing now and I don't understand why it happens... :S

    Elisa.

    Monday, December 14, 2015 6:37 PM
  • Forget.

    Hi cpehusj,

    By default IE has settings that you can modify to change the auto-login behaviour:

    1. Browse the site in IE
    2. Then go to Tools => 'Internet Options' => 'Security' tab.
    3. Check which zone is selected (Internet, Local Intranet or Trusted sites). By default for 'Local Intranet' zone, IE enable auto login. Click on 'Custom Level' button and at the very bottom of the 'settings' section modify the radio button from 'Automatic logon only in Intranet Zone' to 'Prompt for user name and password'
    4. Now you will be prompted for user/name password always. You can revert back the settings again to 'auto login' once you done testing.

    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com


    As Sohel said removing my local sites made the site ask me for credentials.


    Monday, December 14, 2015 6:45 PM