这是我的完整字符串,
Set-Cookie:Authsite = https%3A%2F%2Fmy.where2getit.com%2Flogin.html;路径= /;域= my.where2getit.com,的 W2GISM = 81accd985beefec2b555706ac4ae20eb;路径= /;域= my.where2getit.com; expires = Fri,20-Feb-2015 05:21:40 GMT ;安全;仅Http
我只需要这部分。有什么我可以用拆分或C#中的任何东西吗?请任何帮助
W2GISM = 81accd985beefec2b555706ac4ae20eb;路径= /;域= my.where2getit.com; expires = Fri,20-Feb-2015 05:21:40 GMT
答案 0 :(得分:0)
这对我有用:
var url = "Set-Cookie: Authsite=https%3A%2F%2Fmy.where2getit.com%2Flogin.html; path=/; domain=my.where2getit.com,W2GISM=81accd985beefec2b555706ac4ae20eb; path=/; domain=my.where2getit.com; expires=Fri, 20-Feb-2015 05:21:40 GMT; secure; HttpOnly";
var tab = url.Split(',');
var value = string.Concat(tab[1], tab[2].Split(';')[0]);
Console.WriteLine (value);
输出:
W2GISM=81accd985beefec2b555706ac4ae20eb; path=/; domain=my.where2getit.com; expires=Fri 20-Feb-2015 05:21:40 GMT
答案 1 :(得分:0)
什么是逻辑?是domain = my.where2getit.com static?
根据您的字符串结构使用String.Split()并从输出数组中选择适当的项