I’m sorry if I’m posting this question in the wrong topic or
I’m repeating someone’s question.
I have a problem with my Umbraco (v4.7.2).
Currently I can’t publish content from Umbraco interface
because of ASP.NET request validation. When its turn off everything is working
like a charm.
I was looking for some kind of solution for this because I worry about disabling request validation for my application. So I decided to turn
off the validation programmatically for some time while it’s needed.
My first solution was to subscribe to umbraco.cms.businesslogic.web.Document
events. For example I can disable validation on Document.BeforePublish event
and then turn on validation on Document.AfterPublish event. But this didn’t
work because request validation provides validation before Document.BeforePublish
event took place.
The second solution was to implement custom UsersMembershipProvider
and turning off validation after user has successfully pass authentication. But
the problem I can’t catch any appropriate event to turn on validation when user
for example signs out from Umbraco.
Can you please advise something on this? What is best practice
to make request validation work with Umbraco?
Hmm that's weird, I've never seen that exception before with umbraco.
My 'default.aspx' contains 'validateRequest="false"' in the page directive, does yours too?
Do you have this in your web.config? <httpRuntime requestValidationMode="2.0" />
Else, on which page (probably an iframe) do you get this error? You can add ValidateRequest="false" to that specific page without problem (Umbraco generally is configured that way for most backoffice pages).
Thanks for your answer. Yes I have this entry inside my web.config.
I think I solve my problem. Additionally to ValidateRequest="false" directive I also add EnableEventValidation="false" to this page (Umbraco/editContent.aspx).
ASP.NET Request validation
I’m sorry if I’m posting this question in the wrong topic or I’m repeating someone’s question.
I have a problem with my Umbraco (v4.7.2).
Currently I can’t publish content from Umbraco interface because of ASP.NET request validation. When its turn off everything is working like a charm.
I was looking for some kind of solution for this because I worry about disabling request validation for my application. So I decided to turn off the validation programmatically for some time while it’s needed.
My first solution was to subscribe to umbraco.cms.businesslogic.web.Document events. For example I can disable validation on Document.BeforePublish event and then turn on validation on Document.AfterPublish event. But this didn’t work because request validation provides validation before Document.BeforePublish event took place.
The second solution was to implement custom UsersMembershipProvider and turning off validation after user has successfully pass authentication. But the problem I can’t catch any appropriate event to turn on validation when user for example signs out from Umbraco.
Can you please advise something on this? What is best practice to make request validation work with Umbraco?
That's a lot of information, but the essential part is missing; why is publishing not working? What's the exception / error message?
I'm sorry for missing key part of the question. The error message is the following:
This error occurs when I click Save & Publish button
Hmm that's weird, I've never seen that exception before with umbraco.
My 'default.aspx' contains 'validateRequest="false"' in the page directive, does yours too?
Nope. That the thing I worry about. I don't want to turn off request validation at all. I'm trying to find some solution to make it work with Umbraco.
Good luck with that, I don't think it's possible. Sounds to me like an application-wide configuration istead of path/user based.
Do you have this in your web.config?
<httpRuntime requestValidationMode="2.0" />
Else, on which page (probably an iframe) do you get this error? You can add ValidateRequest="false" to that specific page without problem (Umbraco generally is configured that way for most backoffice pages).
Thanks for your answer. Yes I have this entry inside my web.config.
I think I solve my problem. Additionally to ValidateRequest="false" directive I also add EnableEventValidation="false" to this page (Umbraco/editContent.aspx).
is working on a reply...