-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JsonReaderException error with UseExceptionHandler and postback #1700
Comments
AspNetCore reexecutes the same request with the original POST method. If a DotVVM page is handling the error, we assumed that we need to execute a postback in the Error page. The request body was usually already consumed, and even if wasn't a matching command wasnt found. resolves #1700
Thanks for the report, I have a fix in #1705, I hope we get it released soon in the 4.2. If you'd need backport for 4.1, let me know, this shouldn't be a problem. In the meantime it's possible to work around it by adding a middleware before UseDotvvm which will change the request type to
|
Hi, thanks But, if I use workaround, I now get 403 Forbidden response with:
Can you help with this? |
Yea sorry, you have to enable JS request to the Error page by putting |
Sorry, that's our error, the DisableForRoute method is missing in 4.1. You could use The page will only be displayed automatically in dotvvm Debug mode, otherwise you unfortunately have to define your own handler of the |
OK, I understand.
Thanks a lot, I'll try that. |
AspNetCore reexecutes the same request with the original POST method. If a DotVVM page is handling the error, we assumed that we need to execute a postback in the Error page. The request body was usually already consumed, and even if wasn't a matching command wasnt found. resolves #1700
I end up with this code for display my error page:
|
I using app.UseExceptionHandler("/error") in my Configure method in Startup class.
"/error" is URL to my DotVVM error page which should be displayed to the user when an error occurs.
When an error occurs if there is no postback, everything is fine and the error page is displayed, but if the error occurs during a postback, Newtonsoft.Json.JsonReaderException error occurs and the page is not displayed.
The error occurs because the parsed json is empty:
The text was updated successfully, but these errors were encountered: