如何加密和解密通过<a> tag

时间:2016-11-04 07:02:26

标签: encryption

I have created a hierarchy in which i am putting link and then on click of that i am redirecting to a new page and passing that selected value Query string through ,now i want to encrypt and decrpyt that value..How should i acheive that? Here's My Code:

 <script type="text/javascript">
        google.load("visualization", "1", { packages: ["orgchart"] });
        google.setOnLoadCallback(drawChart);
        function drawChart() {
            $.ajax({
                type: "POST",
                url: '<%=ResolveUrl("~/User/Hierarchy.aspx/GetHierachy") %>',
                //url: "WebForm2.aspx/GetHierachy",
                data: "{'empno':'<%= empno%>'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (r) {
                    var data = new google.visualization.DataTable();
                    debugger;
                    data.addColumn('string', 'Entity');
                    data.addColumn('string', 'ParentEntity');
                    data.addColumn('string', 'ToolTip');
                    for (var i = 0; i < r.d.length; i++) {
                        var empno = r.d[i].toString();
                        //var firstName = r.d[i];
                        //var lastName = r.d[i];
                        data.addRows([

               [{ v: '<%= empno %>' + '-' + '<%=Name%>' },
               '', ''],
              [{ v: empno + '', f: '<a href="TrRequestApproval.aspx?empnum=' + empno + '">' + empno },
                '<%= empno %>' + '-' + '<%=Name%>', empno]
                        ]);

          }

                    var chart = new google.visualization.OrgChart($("#chart")[0]);
                    chart.draw(data, { allowHtml: true, allowCollapse: true });
                },
                failure: function (r) {
                    alert(r.d);
                },
                error: function (r) {
                    alert(r.d);
                }
            });
    }
    </script>

1 个答案:

答案 0 :(得分:0)

查询字符串是URL的一部分。根据定义,它以简单的方式传输。您可以加密该值,但目标页面将在使用前对其进行解密。

如果您有敏感数据,我建议将其作为POST数据发送。