2
Answers

Asp.Net Encryption

Due to security issue reported. where they were intercepting the request and copying the pan number
we encrypted the pan id field. but now there is different issue

 

 <div>
            <asp:TextBox ID="txtCode" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rf" runat="server" ControlToValidate="txtCode" ErrorMessage="Please enter code"></asp:RequiredFieldValidator>
            <asp:TextBox ID="txtPan" runat="server"></asp:TextBox>
            <asp:HiddenField ID="hdnPan" runat="server" />
            <asp:RequiredFieldValidator ID="rfPAN" runat="server" ControlToValidate="txtPan" ErrorMessage="Please Enter PAN">

            </asp:RequiredFieldValidator>
 
            <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClientClick="EncryptPan('0')" OnClick="btnSubmit_Click"/>

        </div>

 function EncryptPan(refId) {
            alert("Hi");
            alert($('#txtPan').val());
            $('#hdnPan').val(EncryptPassword($('#txtPan').val(), refId));
            $("#txtPan").val('********');
    }
the pan is encrypted and stored in hidden field
in txtPAN some masked value is displayed. this is fine
the issue which is occuring is when no value is entered in txtCode textbox required field validator runs message comes Please Enter Code
and at this time value in txtPan is ***
now if validation fails i want to set value in txtPan back to the pan number user entered. how to do this

Answers (2)