QRCoder icon indicating copy to clipboard operation
QRCoder copied to clipboard

query string is getting changed

Open anuragkharegithug opened this issue 3 years ago • 3 comments

Type of issue

[ ] Bug
[ ] Question (e.g. about handling/usage)
[ ] Request for new feature/improvement

Expected Behavior

Current Behavior

Possible Solution (optional)

Steps to Reproduce (for bugs)

Your Environment

anuragkharegithug avatar Jan 10 '22 15:01 anuragkharegithug

Please provide more information, examples, version info, samples...

codebude avatar Jan 10 '22 15:01 codebude

I am using below code

private string GetQRCode(string fullURL) { QRCodeGenerator qrGenerator = new QRCodeGenerator(); QRCodeGenerator.QRCode qrCode = qrGenerator.CreateQrCode(fullURL, QRCodeGenerator.ECCLevel.Q); string QRCodeData = string.Empty; using (Bitmap bitMap = qrCode.GetGraphic(2)) { using (MemoryStream ms = new MemoryStream()) { bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png); byte[] byteImage = ms.ToArray(); QRCodeData = "data:image/png;base64," + Convert.ToBase64String(byteImage);

        }
    }
    return QRCodeData;
}

and in above code I am running a website which is on .NET 4.0 framework. in browser address bard this url comes "https://xxxxxxxxxx.com/vochers/Holiday_Vocher.aspx?eid=86&agentid=94". i generate QRcode using above code and save QRCodeData data in database and later retrieve to show the image on UI and when we scan it shows agentid as qgentid or sometimes aguntid. so please suggest.

anuragkharegithug avatar Jan 10 '22 15:01 anuragkharegithug

@anuragkharegithug based on the code provided by you it's really hard to suggest. One thing is clear here the incoming URL is from the outside which means the root of the issue could be because wrong data coming as a parameter. You need to make sure that the incoming to the function URL is correct. The code which you have provided for generating a QR is not changing the data of the URL. For this, you can create a simple loop for testing and check if the URL will be modified or not. In case of issue gets reproduced re-open the issue once again.

int id = 94; 
string fullUrl;
for (int i = 0; i < 100; i++) {
    id++;
  fullUrl = string.Formatter("https://xxxxxxxxxx.com/vochers/Holiday_Vocher.aspx?eid=86&agentid={0}", id);
GetQRCode(fullUrl); 
}

@codebude I think this one we can close.

h4rdmol avatar Sep 29 '22 00:09 h4rdmol