如何加密发送的数据。AJAX - asp.net Mvc 3

时间:2021-07-12 06:35:12

i have a simple Jquery code which is for sending $.ajax request and passing the login information to controller to check for the login credentials. i want to encrypt the data. please let me know how can i do that?.

我有一个简单的Jquery代码,用于发送$。ajax请求并将登录信息传递给controller以检查登录凭据。我想加密数据。请告诉我该怎么做。

i am posting my Jquery code here to give you an idea.

我在这里发布Jquery代码是为了让您了解我的想法。

=============

= = = = = = = = = = = = =

Jquery Login Button clcik event

$('#btnLogin').click(function (e) {
        var email = $('#Email').val();
        var Password = $('#Password').val();
        var postdata =
        {
            "Email": email,
            "Password": Password
        };
        $('.Loading').fadeIn(50);
        $.ajax({

            url: '@Url.Action("CheckLogin","Home")',
            data: postdata,
            success: function (msg) {
                var data = msg.split(':');
                $('#Result').html(data[0]);
                $('.Loading').fadeOut(50);
             },
            error: function (data) {

                $('#Result').html(data);
                $('.Loading').fadeOut(50);
            }

        });
        e.preventDefault();
    });

========================== as you can see i am passing the username & password in Ajax, when the request goes i can see my username and password in Firebug...

class ========================== ========================== =========================

please help ? thx.

请帮忙吗?谢谢。

1 个解决方案

#1


1  

Put your entire page on SSL (HTTPS).
This will encrypt all data going up and down the wire.

将整个页面放在SSL (HTTPS)上。这将加密所有在电线上下移动的数据。

You'll still see the data in Firebug, but there's nothing wrong with that.
(If the attacker has access similar to Firebug's, there is nothing you can do to defend yourself)

您仍然可以在Firebug中看到数据,但这并没有什么问题。(如果攻击者拥有与Firebug类似的访问权限,您就无法保护自己)

#1


1  

Put your entire page on SSL (HTTPS).
This will encrypt all data going up and down the wire.

将整个页面放在SSL (HTTPS)上。这将加密所有在电线上下移动的数据。

You'll still see the data in Firebug, but there's nothing wrong with that.
(If the attacker has access similar to Firebug's, there is nothing you can do to defend yourself)

您仍然可以在Firebug中看到数据,但这并没有什么问题。(如果攻击者拥有与Firebug类似的访问权限,您就无法保护自己)