If you need to work with SPSecurity.RunWithElevatedPrivilegs() to do for example Site or Web manipulations (the normal user has no rights to do it), you run sometimes into the following error:
"The security validation for this page is invalid. Click Back in your Webbrowser, refresh the page, and try your operation again."
Now, depending on what operation you want to do exactly, this can be solved by
a) Setting SPWeb.AllowUnsafeUpdates = true and/or
b) turning SPWebApplication.FormDigestSettings.Enabled off
Note that I really recommend to set both values back to AllowUnsafeUpdates = false and FormDigestSettings.Enabled = false after you did your stuff. If not you will leave (especially with having Security Validation turned off) a big security hole.
Thursday, February 21, 2008
Tuesday, February 12, 2008
Get rid of SharePoint Error page
Sometimes it is necessary to get the real ASP.NET Error message instead of a nice formated SharePoint error message like this one:
You can change the web.config file of your SharePoint site to display ASP.NET error messages by changing the following
You can change the web.config file of your SharePoint site to display ASP.NET error messages by changing the following
- <sharepoint><safemode maxcontrols="200"><callstack="true" ...
- AND <system.web><customerrors mode="Off" ...
Et Voila:
Monday, February 4, 2008
Boolean parameters in SharePoint definition files are CASE-SENSITIVE, crazy!
This is real SharePoint crap!!!
I just found out, that boolean Parameters in Definition Files (like List Definition, Content Type Definition, Site Columns Definition et cetera- in general all schema.xml definition files) are CASE SENSITIVE!
One example:
<Field
ID="{...}"
Required="True"
/>
This will not work. The Field will not be defined as required. Reasons: SharePoint understands only TRUE / FALSE values written in capital letters - everything else (including True or true) will be ignored and the default setting will be taken (in case of Required the default is false).
In make our example work:
<Field
ID="{...}"
Required="TRUE"
/>
This issue applies also to all other boolean parameters, like
Hidden="TRUE" or FROMBASETYPE="TRUE".
This is something I have never seen before... anyway - that's SharePoint!!!
I just found out, that boolean Parameters in Definition Files (like List Definition, Content Type Definition, Site Columns Definition et cetera- in general all schema.xml definition files) are CASE SENSITIVE!
One example:
<Field
ID="{...}"
Required="True"
/>
This will not work. The Field will not be defined as required. Reasons: SharePoint understands only TRUE / FALSE values written in capital letters - everything else (including True or true) will be ignored and the default setting will be taken (in case of Required the default is false).
In make our example work:
<Field
ID="{...}"
Required="TRUE"
/>
This issue applies also to all other boolean parameters, like
Hidden="TRUE" or FROMBASETYPE="TRUE".
This is something I have never seen before... anyway - that's SharePoint!!!
Labels:
case-sensitive,
definition,
list,
listtemplate,
sharepoint,
wss
Subscribe to:
Posts (Atom)