在客户端ASP.NET MVC中显示错误消息

时间:2018-08-02 19:30:55

标签: c# asp.net-mvc iis vue.js axios

我正在尝试显示消息y用户输入了错误的密码。 在服务器中显示更正消息,但在客户端浏览器中显示错误请求消息。 这是控制器中的代码

throw new Exception ("Incorrect");

Vue模板

axios.post(window.url + 'usuarios/LogIn', this.data).then((response) => {
                        console.log('Correct')
                    }).catch((error) => {
                        // Error                            
                        if (error.response) {
                            console.log(error.response.data);
                            this.error = error.response.data;
                        } else if (error.request) {
                            console.log(error.request);
                            this.error = error.request;
                        } else {
                            console.log('Error', error.message);
                            this.error = error.mes;
                        }

0 个答案:

没有答案
相关问题