-->

Change “access denied…” text string for document l

2019-07-23 15:24发布

问题:

I have a MOSS publishing site and a document library with it's own unique permissions.

On the site home page (default.aspx) I have a document library webpart that shows a list of documents. If the user does not have permissions to view the documents the web part currently displays the message

"Access denied. You do not have permission to perform this action or access this resource."

is there a way to change this message to something more friendly?

回答1:

If inheriting doesn't work out, you could also use jQuery to look for the error message and replace it with something friendly.

There is info about setting up jQuery in SharePoint in this question.



回答2:

I'm not sure I'd fuss with editing the existing .aspx files and go with custom error messages instead:

http://blogs.msdn.com/ketaanhs/archive/2009/03/16/moss-sharepoint-2007-custom-error-page-and-access-denied-page.aspx

Short version is that you use a custom httpmodule and make a couple of web.config changes to make sure the module is loaded and is called on error.