我收到客户的回复:
http://192.168.25.241/CPMO.asmx?wsdl|context=
{transaction_id=9610842, ref_id=14943018526993,
service_id=CPA_MCOM_999, error_list=n/a, sub_eff_date=201705121715460,
notification_ind=2, error_code=1, destination_mobtel=0105660125,
keyword=dummy, CURRENT_STEP=0, sub_exp_date=201705131200000}
注意:
?wsdl|context=
{transaction_id=9610842, ref_id=14943018526993, service_id=CPA_MCOM_999, error_list=n/a, sub_eff_date=201705121715460, notification_ind=2, error_code=1, destination_mobtel=0105660125, keyword=dummy, CURRENT_STEP=0, sub_exp_date=201705131200000}
那么我怎样才能在{}
中读取这个字符串,在阅读参数后,重定向到特定的URL(我的意思是上面的URL),有人能用C#帮我吗?
答案 0 :(得分:0)
您可以按照以下说明阅读字符串。
var text = "{transaction_id=9610842, ref_id=14943018526993, service_id=CPA_MCOM_999, error_list=n/a, sub_eff_date=201705121715460, notification_ind=2, error_code=1, destination_mobtel=0105660125, keyword=dummy, CURRENT_STEP=0, sub_exp_date=201705131200000}";
//replace {} from your string.
var dict = text.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries)
.Select(part => part.Split('='))
.ToDictionary(split => split[0], split => split[1]);