英文:
ASMX service that receive a QRcode string in parameters miss some characters
问题
这是您提供的代码部分:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
//[SoapHeader("User", Required = true)]
public void GetValidationTicket(int idDispositivo, string QRCode, int tipologiaDispositivo, int profiloDispositivo)
请注意,您希望将包含特殊字符 "'" 的 QRCode 转换为 base 64 字符串。问题可能在您的代码中,因为您需要处理输入的 QRCode 来替换这些特殊字符。这可能是您的责任来处理,以便正确转换 QRCode。
您期望的 QRCode 如下所示:
EDAMDAwMjgzNjIwNWSmlmJkpqf2AU1JU2SmmEppdCBBMYVTqDlR7YhGvD6GAcKzTZQl6VGT/gbAOdXbeCL3c++FETwDjL5CqjnyhbLsaTNbO5Cz1lstuAqH8FTa9Jhg1jA=
如果您在调用方的代码中处理了 QRCode,那么问题可能出在调用方代码中。但无论哪里出了问题,您都应确保在处理 QRCode 时正确替换特殊字符。
英文:
I've got this method :
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
//[SoapHeader("User", Required = true)]
public void GetValidationTicket(int idDispositivo, string QRCode, int tipologiaDispositivo, int profiloDispositivo)
that allow me to receive a QRCode of a ticket like this :
APGMDAwMjgzMjc4MmSlaRVkpXqpAU1JU2SlaRhlbiBBMX%2BL8s92v6u5ssAmqFODq8pqH8yZ04YI%2B0KYINjpj9E2tgiOHUyI3RKufv45HcQcM24gyUz8k1FF6xdAy0VDDdg%3D
As you see the QRCode have the special character '%' inside, and this is the problem, cos i need to convert it in base 64 string
Any Idea of the problem? mine or the caller?
thanks
I expect a QRCode like
EDAMDAwMjgzNjIwNWSmlmJkpqf2AU1JU2SmmEppdCBBMYVTqDlR7YhGvD6GAcKzTZQl6VGT/gbAOdXbeCL3c++FETwDjL5CqjnyhbLsaTNbO5Cz1lstuAqH8FTa9Jhg1jA=
答案1
得分: 0
Your QR code is URL encoded. Use HttpUtility.UrlDecode to decode it.
https://learn.microsoft.com/en-us/dotnet/api/system.web.httputility.urldecode?view=net-7.0
%2B = '+'
%3D = '='
You can test this online at a site like this one:
https://www.urldecoder.org/
英文:
Your QR code is URL encoded. Use HttpUtility.UrlDecode to decode it.
https://learn.microsoft.com/en-us/dotnet/api/system.web.httputility.urldecode?view=net-7.0
%2B = '+'
%3D = '='
You can test this online at a site like this one:
https://www.urldecoder.org/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论