How to suppress error message details to general DNN Users
I have a DNN site (05.02.03) in test and nearing release into production and I would like to suppress the details of error me开发者_高级运维ssages (i.e. Null Reference Exception, and others) to general users (admins can still see the details). Debug is off in the web.config.
By suppressing, I mean the only error message I want to display to the general user (all users) is something like "An Exception has occured". I don't want the details of that exception to be displayed to the general user. I still want it logged in greater detail in the Event Viewer.
How would I go about doing this?
Update: I have "Use Custom Error Messages" checked. Which shows a error message like:
A critical error has occurred.[vbCrLf] Object reference not set to an instance of an object.
I want just the "A critical error has occured." error message to be displayed to general users.
I don't want the "Object referece not set to an instance of an object." to be displayed to general users
You should have "Use Custom Error Messages" checked in the Host Settings.
If UseCustomErrorMessages is checked, ProcessModuleLoadException
will behave almost as you specified. It will log messages to EventLog and will show a friendly error message without exception details. Message header texts are found in SharedResources.resx.
However, DNN custom error messages uses objUserInfo.IsSuperUser
to check if the user is a Host account. Users in the Administrators role will behave like a normal users.
A little caveat: I checked these from DNN 4.9.5 sources, you should double-check from yours.
精彩评论