ASMX服务在参数中接收一个QR码字符串,缺少一些字符。

huangapple go评论80阅读模式
英文:

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/

huangapple
  • 本文由 发表于 2023年7月6日 18:52:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/76628053.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定