Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've used the following powershell script to change the default access denied page for my web Application:

Set-SPCustomLayoutsPage -Identity "AccessDenied" -RelativePath "/_layouts/Custom/AccessDenied.aspx" -WebApplication "MyWebApp"

My Web Server (wfe) is behind an UAG server and I receive the following error: This error (HTTP 403 Forbidden) means that Internet Explorer was able to connect to the website, but it does not have permission to view the webpage.

(My custom AccessDenied.aspx page is based on a custom application page OOTB VS2010)

Update: When I copy paste the OOTB AccessDenied.aspx page and make a small change, this error does not come up and the page is displayed correctly... It looks like an issue with the master page it's using, when using the simple.master I have no problems, when you try to apply a custom or default the error pops up

share|improve this question
    
Are you redirected your custom Access Denied page (based on the URL)? –  EStruyf Nov 21 '11 at 17:02
    
I don't understand your question so well. I didn't configure any redirection, just applied the above PS statement –  Wim Hill Nov 21 '11 at 17:16
    
When you do not have permissions, SharePoint will redirect you to the access denied page. Does it redirect you to your configured page (it does not matter if you get the error)? –  EStruyf Nov 21 '11 at 17:55
    
do you have any code written in there? –  Ashish Patel Nov 21 '11 at 20:18
    
There's no custom code (behind) in the page. I'm redirected to my configured page –  Wim Hill Nov 22 '11 at 7:21
add comment

2 Answers

up vote 3 down vote accepted

I had the same behavior on my site. (SP2010 Enterprise using Windows auth (NTLM)).

The way I solved it is to create a _layouts deployment project to deploy my custom401.aspx (will come back to it).

Updated my webapplication with:

$urlWebApplication = "http://myApp"
$pathPage401 = "/_layouts/myproject/custom401.aspx"

#Change 401 page for webapp
Set-SPCustomLayoutsPage -Identity AccessDenied -WebApplication $urlWebApplication -RelativePath $pathPage401 

#Check if changed

Get-SPCustomLayoutsPage -WebApplication $urlWebApplication

IISRESET

For the aspx page, there are 2 important steps.:

  1. Make sure your page inherits UnsecuredLayoutsPageBase and not the default.

  2. Make sure the masterpage is referenced using:

    MasterPageFile="~/_layouts/simple.master" 
    

    and not:

    DynamicMasterPageFile="~masterurl/default.master" 
    

    as it will try to access resources on the site which will trigger the 403.

Beside that it's pretty straightforward.

share|improve this answer
add comment

By default VS.NET 2010 uses LayoutsPageBase as your base class. You need to modify it to UnsecuredLayoutsPageBase so that your custom access denied page is derived from UnsecuredLayoutsPageBase.

share|improve this answer
    
Unfortunatly this didn't resolve the problem! –  Wim Hill Nov 21 '11 at 19:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.