Questions tagged [request-validation]

79 questions
70
votes
4 answers

Login request validation token issue

I have been going through the error logs of a development project and found the following error (name changed to protect the guilty innocent)- The provided anti-forgery token was meant for user "", but the current user is "admin". This was not…
pwdst
  • 13,909
  • 3
  • 34
  • 50
30
votes
7 answers

Disable request validation redirect in Laravel 5.4

So I'm trying to develop a rest API for an internal project, and I've got an issue where when the form request validation fails, it shows the @index response. So I have two routes; Route::get('/api/clients',…
KeironLowe
  • 711
  • 1
  • 8
  • 21
24
votes
3 answers

How do I get ONLY the validated data from a laravel FormRequest?

Lets say I have the following Custom Request: class PlanRequest extends FormRequest { // ... public function rules() { return [ 'name' => 'required|string|min:3|max:191', …
JonTroncoso
  • 791
  • 1
  • 8
  • 22
20
votes
2 answers

Request Validation - ASP.NET MVC 2

Has request validation changed for ASP.NET MVC 2, more precisely, not validating? I did the following: Web.configs (in App directory and Views directory)
Omar
  • 39,496
  • 45
  • 145
  • 213
16
votes
5 answers

How do I disable request validation without setting RequestValidationMode to 2.0?

We've just upgraded to ASP.NET 4.0, and found that requestValidation no longer works. The MSDN docs suggest we need to set requestValidationMode in web.config to 2.0: 4.0 (the default). The HttpRequest object internally sets a flag that indicates…
Danny Tuppeny
  • 40,147
  • 24
  • 151
  • 275
14
votes
4 answers

How to display a custom error page when Request Validation Exceptions are thrown?

We've configured our custom error pages as below for exceptions thrown by ASP.NET:
Ben Foster
  • 34,340
  • 40
  • 176
  • 285
12
votes
4 answers

How do I override RequestValidation in ASP.NET WebAPI

I'm having problems with requests that include 'dangerous characters' as part of a Web API URL. The Url includes an & which is properly Url encoded, but still causes a Request Validation ASP.NET error. Unlike MVC there appears to be no…
Rick Strahl
  • 17,302
  • 14
  • 89
  • 134
11
votes
4 answers

I can't turn off Request Validation for an ASP.NET MVC Controller

I am trying to turn off Request Validation for all action methods in a controller by doing this: [ValidateInput(false)] public class MyController : Controller { ... The reference I am using says this is possible and tells me to do it this way,…
Ronnie Overby
  • 45,287
  • 73
  • 267
  • 346
10
votes
8 answers

Laravel 5.5 - Validate Multiple Form Request - at the same time

The question is already asked here for a previous version of laravel and not yet answered. I have a html form which is validated using three different Form Request Validations. I am able to do this. But, the problem is, the form validations take…
iamab.in
  • 2,022
  • 3
  • 18
  • 39
9
votes
1 answer

How to handle ASP.NET MVC3 Request Validation exceptions as model or property validation errors

My question is hopefully pretty straight forward. Upon submitting my form, I would like to flag all properties (fields) that have invalid characters (specifically HTML) as model errors. The issue I am facing is that Request Validation kicks in…
zam6ak
  • 7,229
  • 11
  • 46
  • 84
9
votes
1 answer

How to return ActionResult along with async foreach and IAsyncEnumerable

I have a controller method of this signature: public async IAsyncEnumerable Get() It works fine but I need to do some request validation and return 401, 400, and other codes accordingly, which it does not support. Alternatively, the…
7
votes
1 answer

Enable CORS when using AWS API Gateway Request Validator

I setup AWS API Gateway with CORS successfully, when a request is valid I have a 200 status code and also CORS headers, that's nice. But when AWS API Gateway Request Validator detects an invalid input, I have the status code is 400 but CORS headers…
Yves M.
  • 29,855
  • 23
  • 108
  • 144
5
votes
2 answers

Laravel, Handling validation errors in the Controller

So i'm working on validating a form's inputs using the following code: $request->validate([ 'title' => 'bail|required|max:255', 'body' => 'required', ]); So basically, there are two fields in the form, a title and a body and they have the…
marmahan
  • 69
  • 1
  • 1
  • 7
5
votes
0 answers

Cross-site scripting (XSS) patterns can be submitted

Cross-site scripting (XSS) patterns can be submitted. [HttpPost] [AllowAnonymous] [ValidateInput(false)] public async Task Index(string Xml) => await Process(Xml); If i remove ValidateInput(false) Tag it throws exception. "Potential…
5
votes
3 answers

Control level ValidateRequestMode has no effect

I'm using ASP.NET WebForms (.NET 4.5) and have an "content block" control, which is reused on a number of pages. I've tried setting the ValidateRequestMode of the control and even individual elements to "Disabled", but the request validation coming…
EvilBeer
  • 2,054
  • 2
  • 19
  • 37
1
2 3 4 5 6