Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ServiceStack Disable HttpRequestValidation

I'm offering a simple test service, now a clients posts a payload which is considered dangerous so the httpRequestValidation failes.

I tried to deactivate the HTTPValidation like I do in MVC

  <pages validateRequest="false">

but this doesnt help. is there something special I have to set for ServiceStack ?

Exception Details:

System.Web.HttpRequestValidationException occurred
HResult=-2147467259 Message=Ein möglicherweise gefährlicher Request.Form-Wert wurde vom Client (payload="... [email protected]...") entdeckt. Source=System.Web ErrorCode=-2147467259 WebEventCode=0 StackTrace: bei System.Web.HttpRequest.ValidateString(String value, String collectionKey, RequestValidationSource requestCollection)
InnerException:

Any hints ?

like image 578
Boas Enkler Avatar asked Nov 28 '25 06:11

Boas Enkler


1 Answers

ServiceStack doesn't add any request validation itself so this is likely an ASP.NET validation restriction. See this answer for more details:

To disable Request validation, ensure that you have added both to Web.config:

<httpRuntime requestValidationMode="2.0"/>

<configuration>
    <system.web>
        <pages validateRequest="false" />
    </system.web>
</configuration>
like image 96
mythz Avatar answered Dec 01 '25 16:12

mythz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!