Showing validation error - asp.net-core-mvc

Is it possible to show the request validation error message in the error page of my ASP.NET Core app when for instance Identity Server sends a: Requested scope not allowed: {myscope} ?
As it is now, all validation errors just show the /home/error?errorId=12345 page without further information.
So basically my question is: How do I get more details of the validation error?

You are not supposed to show detailed error messages to the end user - this is a security risk.
Use the log to find out exactly what is wrong.

Related

Display custom error message in ajax over HTTP/2

In my MVC application, I have used Ajax's Response.StatusText to display custom error messages to user whenever there is some error.It works fine but when I deploy my application on AWS, the StatusText gets removed and only the code is displayed. Got to know that because of using HTTP/2, the statusText gets removed.
Is there a way to show custom error message in Ajax error over HTTP/2 ?
Thanks in advance.
I don't think the HTTP Status is the best place to put these. You should either put this status in the body, or possibly in a custom HTTP header.

I am getting the error while running the script for the default magento checkout

The rest of the script is working properly but on checkout getting 403 / 404 error. I am not getting why it is happening. Do i need to pass cookies or session Id to get successful checkout or what can I do. please suggest in brief.
Even if you get "green" result and HTTP Response code 200 it doesn't guarantee that your test is doing what it is supposed to do, add View Results Tree listener and inspect response details starting from login, I think your test even doesn't perform a successful login.
So a couple of general recommendations:
Always add HTTP Cookie Manager to your Test Plan
Magento uses some form of CSRF Protection so you will need to get form_key parameter form the previous response and add it to the next request. See the following reference material for more information:
Magento CSRF attack: A Simple Explanation
How to Load Test CSRF-Protected Web Sites

How to add the unhandled exceptions accross the applications in response body in WEB API

How to add the unhandled exceptions accross the applications in response body in WEB API. If there is no exceptions a success message needs to be sent to the response body for all the responses....Need help on achieving this.
You need two things. For handling the exceptions, you need to set the IncludeDetailErrorPolicy in the HttpConfiguration object,
You can configure the error policy preferences as part of the configuration object (HttpConfiguration) in the IncludeErrorDetailPolicy property. This is just an enum that instructs Web API about how to deal with exceptions.
The possible values for this enum are,
Default: It’s uses the customErrors configuration settings if you are using ASP.NET as host or LocalOnly for self-host.
LocalOnly: Only includes error details for local requests
Always: Always includes error details
Never: Never includes error details
When an exception happens, Web API will check the value on this setting for including details about the exception in the response message or not. For example, if Always is enabled, Web API will serialize the exception details as part of the message that you get as response.
The success message does not make much sense as you already have the response status code. A status code equals to OK means that everything went ok. If you still want to add an additional message, use a HttpMessageHandler that checks for the response status code. If the status code is OK, add the message. However, the response body has been set already at that point so you will not able to modify it. You might able to add a message as a header.

500 internal server error while trying to use the registration form

I am using the registration form that is already available in the user manager option in my website.
But once I click on the register button I get this message:
Server error The website encountered an error while retrieving
http://prachi.matrimony4me.in/index.php/sample-sites-2?task=registration.register.
It may be down for maintenance or configured incorrectly. Here are
some suggestions: Reload this webpage later. HTTP Error 500 (Internal
Server Error): An unexpected condition was encountered while the
server was attempting to fulfill the request.
Try turing off SEF in the main joomla configuration.
refresh the page and try agian?
are you using
JRoute:_('index.php') or JRoute:_('index.php?option=com_users')
in your form action?
the link just looks wrong.
Is that the default registration form ? there shouldnt be any task in the url.

Error message when using google contact api

When I try to fetch contacts from gmail, I received this error message:
The page you have requested cannot be displayed. Another site was requesting access to your Google Account, but sent a malformed request. Please contact the site that you were trying to use when you received this message to inform them of the error. A detailed error message follows:
The site "http://url.com" has not been registered.
May I know how to rectify it? Thanks!
Have you tried registering the domain with Google's API?
docs:
https://developers.google.com/accounts/docs/RegistrationForWebAppsAuto#new
resgister url:
https://accounts.google.com/ManageDomains
Also if you are making calls from http and not https you may be seeing problems there too.

Resources