0

I creating a library to mask the website field sensitive info such as account no and account name during load the website by enter the URL. I facing problem to get the URL and replace the masked information in the website.

public string GetDataInfo(String productName, String AccountNumber)
    {
             string str_Result = string.Empty;

        try
        {
            dynamic Account = new Newtonsoft.Json.Linq.JObject();
            Account.AccountName = productName;
            Account.AccountNumber = AccountNumber;
            string json = Newtonsoft.Json.JsonConvert.SerializeObject(Account);
            string json1 = Newtonsoft.Json.JsonConvert.SerializeObject(Account.AccountName);
            string json2 = Newtonsoft.Json.JsonConvert.SerializeObject(Account.AccountNumber);

            Console.WriteLine(json.ToString());
            var content = Regex.Replace(json1, "[q,e,t,u,o,a,d,g,j,l,z,c,b,m]|[Q,E,T,U,O,A,D,G,J,L,Z,C,B,M]|[1,3,5,7,9]", "*");
            var content1 = Regex.Replace(json2, "[q,e,t,u,o,a,d,g,j,l,z,c,b,m]|[Q,E,T,U,O,A,D,G,J,L,Z,C,B,M]|[1,3,5,7,9]", "*");
            Account.AccountName = "";
            Account.AccountNumber = "";
            Account.AccountName = content;
            Account.AccountNumber = content1;
            string json3 = Newtonsoft.Json.JsonConvert.SerializeObject(Account);
            Console.WriteLine(json3);
            str_Result = json3;
JonathanK
  • 37
  • 5
  • Very similar to this: https://stackoverflow.com/questions/50587565/create-custom-json-converter-that-masks-sensitive-information/50587916 – Farhad-Taran May 29 '20 at 08:43
  • i would like to create the library to mask some certain field, but the field will be configure in mssql table. im new to C# and javascript – JonathanK May 29 '20 at 08:48
  • If you are a beginner, I suggest reading a book thoroughly or this documentation and going through all exercises: https://learn.microsoft.com/en-us/aspnet/core/getting-started/?view=aspnetcore-3.1&tabs=windows – Farhad-Taran May 29 '20 at 08:52

0 Answers0