1
I am developing a web site in ASP.NET MVC that uses jquery to control some plugins like spinner, toastr and others. My question is whether I should call Action via jquery to validate the model and within the Action make a Rest call (which was built in web api) and return the response in the javascript function.
As I worked a lot with mobile, most of the calls were made on the client, and in this case I see that the call is being made inside the controller, in the case, on the server.
This result action could not be an event in jQuery?
– Bruno Wego
I don’t think so, it basically validates the model that was passed via post and executes a Rest call to Autentication. If OK, it generates the cookie and the User ticket
– Juan Munhoes Junior
I don’t quite understand your scenario, would it be something like an Oauth? Where the client has previously authenticated itself in a Webapi that manages access to multiple applications, then when accessing the application, makes a request to this Webapi to validate the access to then proceed?
– Tobias Mesquita
That’s right @Tobymosque. Do you think I’m doing it wrong? see this same scenario for my other controllers, who need to access the webapi where the call of the methods are made in the controller
– Juan Munhoes Junior
I think you’re on the right track, but I advise you to create a custom Action filter for authentication and put all your logic into it.
– Tobias Mesquita