This project is read-only.
1
Vote

Getting 403 error for claims based sites

description

SPWakeup doesn't seem to work for webapps set for using claims-based authentication. Claims sites fail with a 403 error, probably because spwakeup is not claims-aware.
 
An example of implementing claims in .net can be found here:
http://sudheerkovalam.wordpress.com/2010/11/04/writing-windows-phone-apps-for-sharepoint/
 
Can this be implemented in spwakeup?

comments

hairyken wrote Jul 6, 2012 at 1:41 PM

Additional info: seems that mine is a problem with multiple authentication scenario's where you have both Windows Integrated and forms-based authentication (or any other authentication) active on the same webapp. Solution (in code) is to add the header "X-FORMS-BASED-AUTH-ACCEPTED: f" to the http GET request, in which case it is forced to use Windows Integrated. So if this could be implemented in spwakeup it would resolve the 403 issue with these sites...

krill123 wrote Feb 7, 2013 at 6:57 PM

Hi,

We are having the same issue. Can you post the modified PS1 that will allow us to wake up claime based sites?

Thank you,


Erik

wrote Feb 21, 2013 at 11:56 PM

atyler wrote Mar 13, 2013 at 8:03 PM

Any progress on this one? I'm running into the same issue. Otherwise I think the tool is great on my SharePoint 2010, 2008 R2 environment. Single front end, single SQL server.

hairyken wrote Mar 15, 2013 at 10:17 AM

If you run into this problem, you can use the following powershell script to wakeup all sites, including those on a Claims-based, provided the claims site has NTLM or Kerberos enabled (i.e. it doesn't work on webapps that only have forms or third party authentication).
param(
    [string]$webapp=$null
)

Add-PSSNapin Microsoft.Sharepoint.Powershell -ErrorAction SilentlyContinue

function WarmupSite() {
    param([System.Net.NetworkCredential]$NetworkCred,$Web)

    $request = [System.Net.WebRequest]::Create($Web.Url)
    $request.AllowAutoRedirect = $true
    $request.proxy = [System.Net.WebRequest]::DefaultWebProxy

    $request.Credentials = $NetworkCred
    $request.ContentType = "application/x-www-form-urlencoded"
    $request.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED","f")

    $request.Method="GET"
    $request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)"

    $response = $request.GetResponse()
    return $response.StatusCode
}

function RecurseSite() {
    param($SiteIdentity)
    write-output "Site: $($SiteIdentity.Url) – $($SiteIdentity.Title)"
    $cred = [System.Net.CredentialCache]::DefaultNetworkCredentials
    
    Get-SPWeb -site $SiteIdentity.URL -limit All | % {
            $result = (WarmupSite -NetworkCred $cred -Web $_)
            If ($result -eq "OK") {
                "Woke up $($_.Url)"|write-host -back darkgreen
            } else {
                "Failed waking $($_.url): $result" | write-host -back darkred
            }
   }
}

if ($webapp) {
    $params = @{Identity=$webapp}
}

Get-SPWebApplication -IncludeCentralAdmin:$false @params | % {
    foreach ($sitecollection in $_.Sites) {
        write-output "Site collection: $($sitecollection.Url)"
        RecurseSite -SiteIdentity $($sitecollection.RootWeb)
    }
}