codebude / QRCoder

A pure C# Open Source QR Code implementation
MIT License
4.46k stars 1.09k forks source link

query string is getting changed #374

Closed anuragkharegithug closed 3 months ago

anuragkharegithug commented 2 years ago

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

codebude commented 2 years ago

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

anuragkharegithug commented 2 years ago

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.

h4rdmol commented 1 year ago

@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.