Monthly Archives: December 2017

System.Net.WebRequest throws a “(401) Unauthorized” error: The Double Hop Syndrome.

When using System.Net.WebRequest to POST (or GET) data to a SharePoint page, a 401 Unauthorized error occurs. For example: Uri address = new Uri(“http://mysiteurl.com/somepage.aspx?someparam=something”); System.Net.WebRequest request = System.Net.WebRequest.Create(address); request.Credentials = System.Net.CredentialCache.DefaultCredentials; request.Method = “GET”; System.Net.WebResponse response = request.GetResponse();  response.Close(); The … Continue reading

Posted in SharePoint 2016, Visual Studio 2010 | Leave a comment

Get error messages by Correlation ID

When I get an error in SharePoint with a correlation ID, I find it easy to use the following PowerShell script to search for the detailed error message within the farm: Add-PsSnapin Microsoft.SharePoint.PowerShell Merge-SPLogFile -Path C:\Temp\log\log.txt -Level “Unexpected” -Correlation 6911329e-d6ff-c016-d2d4-1cd533dc1c03 … Continue reading

Posted in PowerShell, SharePoint 2010, SharePoint 2016 | Leave a comment