问题描述
对方传过来的格式是:Content-Type:application/x-www-form-urlencodedAccept-Encoding:gzip接收到以下数据:domain=dwpetsfashion.com&my_var_1=Mailgun+Variable+%231&my-var-2=awesome&message-headers=%5B%5B%22Received%22%2C+%22by+luna.mailgun.net+with+SMTP+mgrt+8734663311733%3B+Fri%2C+03+May+2013+18%3A26%3A27+%2B0000%22%5D%2C+%5B%22Content-Type%22%2C+%5B%22multipart%2Falternative%22%2C+%7B%22boundary%22%3A+%22eb663d73ae0a4d6c9153cc0aec8b7520%22%7D%5D%5D%2C+%5B%22Mime-Version%22%2C+%221.0%22%5D%2C+%5B%22Subject%22%2C+%22Test+deliver+webhook%22%5D%2C+%5B%22From%22%2C+%22Bob+%3Cbob%40dwpetsfashion.com%3E%22%5D%2C+%5B%22To%22%2C+%22Alice+%3Calice%40example.com%3E%22%5D%2C+%5B%22Message-Id%22%2C+%22%3C20130503182626.18666.16540%40dwpetsfashion.com%3E%22%5D%2C+%5B%22X-Mailgun-Variables%22%2C+%22%7B%5C%22my_var_1%5C%22%3A+%5C%22Mailgun+Variable+%231%5C%22%2C+%5C%22my-var-2%5C%22%3A+%5C%22awesome%5C%22%7D%22%5D%2C+%5B%22Date%22%2C+%22Fri%2C+03+May+2013+18%3A26%3A27+%2B0000%22%5D%2C+%5B%22Sender%22%2C+%22bob%40dwpetsfashion.com%22%5D%5D&Message-Id=%3C20130503182626.18666.16540%40dwpetsfashion.com%3E&recipient=alice%40example.com&event=delivered×tamp=1457774830&token=087042f5515085f0300751f0f25ee59dafae2b819499ab6d3c&signature=df522b97eda716dc616279769463f090397e511ef08090a6357f91b4c7df03d6&body-plain=怎么解码后得到以下数据signature:df522b97eda716dc616279769463f090397e511ef08090a6357f91b4c7df03d6event:delivereddomain:dwpetsfashion.commy-var-2:awesomemessage-headers:[["Received","byluna.mailgun.netwithSMTPmgrt8734663311733;Fri,03May201318:26:27+0000"],["Content-Type",["multipart/alternative",{"boundary":"eb663d73ae0a4d6c9153cc0aec8b7520"}]],["Mime-Version","1.0"],["Subject","Testdeliverwebhook"],["From","Bob<bob@dwpetsfashion.com>"],["To","Alice<alice@example.com>"],["Message-Id","<20130503182626.18666.16540@dwpetsfashion.com>"],["X-Mailgun-Variables","{"my_var_1":"MailgunVariable#1","my-var-2":"awesome"}"],["Date","Fri,03May201318:26:27+0000"],["Sender","bob@dwpetsfashion.com"]]recipient:alice@example.combody-plain:Message-Id:<20130503182626.18666.16540@dwpetsfashion.com>my_var_1:MailgunVariable#1timestamp:1457774830token:087042f5515085f0300751f0f25ee59dafae2b819499ab6d3c
解决方案
解决方案二:
这个你要问post消息给你的人,是怎么编码的,你用对应的方式解码。
解决方案三:
strings="domain=dwpetsfashion.com&my_var_1=Mailgun+Variable+%231&my-var-2=awesome&message-headers=%5B%5B%22Received%22%2C+%22by+luna.mailgun.net+with+SMTP+mgrt+8734663311733%3B+Fri%2C+03+May+2013+18%3A26%3A27+%2B0000%22%5D%2C+%5B%22Content-Type%22%2C+%5B%22multipart%2Falternative%22%2C+%7B%22boundary%22%3A+%22eb663d73ae0a4d6c9153cc0aec8b7520%22%7D%5D%5D%2C+%5B%22Mime-Version%22%2C+%221.0%22%5D%2C+%5B%22Subject%22%2C+%22Test+deliver+webhook%22%5D%2C+%5B%22From%22%2C+%22Bob+%3Cbob%40dwpetsfashion.com%3E%22%5D%2C+%5B%22To%22%2C+%22Alice+%3Calice%40example.com%3E%22%5D%2C+%5B%22Message-Id%22%2C+%22%3C20130503182626.18666.16540%40dwpetsfashion.com%3E%22%5D%2C+%5B%22X-Mailgun-Variables%22%2C+%22%7B%5C%22my_var_1%5C%22%3A+%5C%22Mailgun+Variable+%231%5C%22%2C+%5C%22my-var-2%5C%22%3A+%5C%22awesome%5C%22%7D%22%5D%2C+%5B%22Date%22%2C+%22Fri%2C+03+May+2013+18%3A26%3A27+%2B0000%22%5D%2C+%5B%22Sender%22%2C+%22bob%40dwpetsfashion.com%22%5D%5D&Message-Id=%3C20130503182626.18666.16540%40dwpetsfashion.com%3E&recipient=alice%40example.com&event=delivered×tamp=1457774830&token=087042f5515085f0300751f0f25ee59dafae2b819499ab6d3c&signature=df522b97eda716dc616279769463f090397e511ef08090a6357f91b4c7df03d6&body-plain=";varrs=HttpUtility.ParseQueryString(s);for(inti=0;i<rs.Count;i++)Response.Write(rs.GetKey(i)+":"+rs[i]+"<br/>");
解决方案四:
asp.net使用Request.Form[name]来获取post来的值。还“解码”什么东东?你试试Rquest.Form["Message-Id"]
解决方案五:
如果纠结“解码”,除非你根本没有使用asp.net,或者对方根本没有按照正规的httppost协议来提交消息。还有一种情况,就是你明明不用想太多,但是想太多了。