I want to throw an exception in ActionFilterAttribute like this:
Public override zero on-one acquisition ( ActionXpiting Contact Filter Contex) {base.OnActionExecuting (filterContext); If (! _ Controller .hourndex ()) (throw a new exception (resource. Back Office.lblErrorPermission);}}
I like it, because I executed this code in some Ajax request I want to do this, and when the user is not allowed, send an exception and then showing the message
I have the code to display the message in the exception, and to remove it in other places of the application Works, but when ActionAngelFormerAttribute An exception is placed in the onion expingment of, then an unrestricted exception application, and what is found in the scene is a server error.
How can I handle exceptions without redirecting to another page? I just want to throw exceptions, no 404 error page shows.
Edit:
To talk in context: I have a web The page has some AJAX calls, I wanted That is a behavior to call AJAX when the call was made, an error occurred, so I have something like this in all my AJAXs:
$ .ajax ({. .. Error: Function (e, o, errortext) {Alert messages: Set alarmsase andshop (error text);}, ...});
This code shows a modal window with a friendly user message due to error: the session has expired. Bad email addresses, etc.
I want to use the same code for verification. And with the verification I was thinking about using ActionFilterAttribute.
But I can not send exceptions to the ongoing expansion and how to get an exception.
Is this possible? Or should I have to return a specific Jason and then in relation to the return of JSN to the Javascript Act?
Comments
Post a Comment