简体   繁体   中英

ASP.Net and Jquery client side password pass to server side

I'm using ASP.Net MVC to build a website. I have a login form that needs username and password for verification. Now, I'm using JQuery ajax to pass the username and password to controller and controller and call rest api to verify. Sample code as below:

   $.ajax({
        url: "/Home/AddNew",
        method: 'POST',
        data:{
            Username: $("#txtUserName").val().trim(),
            Password: CryptoJS.MD5($("#txtPassword").val().trim()).toString()
        }
    });

But, this way I think is not very secure as very easy to break it. Does anyone know how to pass password to controller from Javascript in mode secure way?

Just to clarify, there is not a 100% secure method to send any kind of data with Ajax, or even a normal POST.

The only way to secure your login page is to use SSL/TLS Certificates, if you have a good SSL/TLS certificate nobody can sniff out the password from observing your network traffic

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM