locked
The website declined to show this webpage. HTTP 403. The website requires you to log in.

    Question

  • Hello,

    Here is my situation. We have a webpart/usercontrol code in our SharePoint publishing site collection. We have test and production invironments, both with multiple app servers, where this code is deployed and worked fine until we made a change in it. Now, when we deploy it in test environment, it works fine, but when we move it to production, some users get below error when they try to access pages with that usercontrol code.

    *******
    The website declined to show this webpage
    HTTP 403
    Most likely causes:
    This website requires you to log in.
    *******

    We cannot figure out why. We checked the configuration of test and production environments - they look the same. I know I'm giving very little information, but I just wanted to know where to look for a solution. Is it the code? Or, is it some configuration in IIS, SharePoint or Virtual Folder access? What do you think? Any ideas will be much appreaciated.

    Thank you!

    Regards, R.D.M.
    Tuesday, October 06, 2009 2:48 PM

Answers

  • Hi,

           It seems that you have got HTTP 403 permission problem with your own webpart(with usercontrol).

           Here are several action plans for your issue:

    1.       Where did you deploy your UserControl ? Did it locate in this path

                        “Driver:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES”?

                         Please try take ownership of usercontrol(ascx file).

                         Also, if your webpart is built with dll, please also try take ownership of the bin(Driver:\Inetpub\wwwroot\wss\VirtualDirectories\port) folder on production server.

     

    2.       Would you please re-check your code logic. And In your custom web part code, you can use RunWithElevatedPriviledges to void permission issue in code level.

    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx

     

    3.       Did you use AllWebs["myweb"] property in your code logic? This is a method only for administrator. Instead, you can use SPWeb.GetSubWebsForCurrentUser http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.getsubwebsforcurrentuser.aspx in your code.

     

              Hope this can help.     

     Best Regards,

    -Aaron

    • Marked as answer by rdoe777 Wednesday, October 14, 2009 4:39 AM
    Tuesday, October 13, 2009 4:04 AM

All replies

  • Hi,

           It seems that you have got HTTP 403 permission problem with your own webpart(with usercontrol).

           Here are several action plans for your issue:

    1.       Where did you deploy your UserControl ? Did it locate in this path

                        “Driver:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES”?

                         Please try take ownership of usercontrol(ascx file).

                         Also, if your webpart is built with dll, please also try take ownership of the bin(Driver:\Inetpub\wwwroot\wss\VirtualDirectories\port) folder on production server.

     

    2.       Would you please re-check your code logic. And In your custom web part code, you can use RunWithElevatedPriviledges to void permission issue in code level.

    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx

     

    3.       Did you use AllWebs["myweb"] property in your code logic? This is a method only for administrator. Instead, you can use SPWeb.GetSubWebsForCurrentUser http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.getsubwebsforcurrentuser.aspx in your code.

     

              Hope this can help.     

     Best Regards,

    -Aaron

    • Marked as answer by rdoe777 Wednesday, October 14, 2009 4:39 AM
    Tuesday, October 13, 2009 4:04 AM
  • Hello Aaron,

    Thank you for your answer!

    We were able to find the cause of my issue. It was because of the authenticated users permission not applied on the Virtual Directories. Your suggestion to take ownership of led us to this, so I must mark your post as an answer. And thanks for the third information, I didn't know about GetSubWebsForCurrentUser property. Very useful.

    Cheers!

    Regards, R.D.M.
    Wednesday, October 14, 2009 4:38 AM