Abdul Abdul - 1 year ago 164
Vb.net Question

Data Masking in asp.net

i want to display confidential data like bank account number, mobile numbers in

format in ASP.net controls. Like
will be
and on update it should save the actual data entered.

How it would be achieved in ASP.net?

Answer Source

If you want to mask it only for users which can't update it as commented, it's simple:

Dim number = "022-23232-2322" 
Dim token = number.split("-"c)
Dim masked = String.Format("{0}{1}{2}", token(0), New String("*"c, 9), token.last())

Result as dersired: 022*********2322

Of course you have to store the real number serverside or load it from database when you need it. You should never need to unmask it. If an authorized user wants to update it you get the new value and you don't need the old. If you need it reload it from the data-source.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download