C# 我需要完整字符串中的某一部分

C# 我需要完整字符串中的某一部分,c#,C#,这是我的完整字符串 设置Cookie:Authsite=https%3A%2F%2Fmy.where2getit.com%2Flogin.html;路径=/;domain=my.where2getit.com,W2GISM=81accd985beefec2b555706ac4ae20eb;路径=/;domain=my.where2getit.com;expires=2015年2月20日星期五05:21:40 GMT;保护HttpOnly 我只需要这部分。我能用split或C语言做些什么吗?请帮忙

这是我的完整字符串

设置Cookie:Authsite=https%3A%2F%2Fmy.where2getit.com%2Flogin.html;路径=/;domain=my.where2getit.com,W2GISM=81accd985beefec2b555706ac4ae20eb;路径=/;domain=my.where2getit.com;expires=2015年2月20日星期五05:21:40 GMT;保护HttpOnly

我只需要这部分。我能用split或C语言做些什么吗?请帮忙

W2GISM=81accd985beefec2b555706ac4ae20eb;路径=/;domain=my.where2getit.com;expires=2015年2月20日星期五05:21:40 GMT


这对我有用:

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

逻辑是什么?domain=my.where2getit.com是静态的吗


根据字符串结构使用String.Split(),并根据什么逻辑从输出数组中选择适当的项?Try
var result=“W2GISM=81accd985beefec2b555706ac4ae20eb;路径=/;域=my.where2getit.com;到期日=Fri,2015年2月20日05:21:40 GMT”。看起来您需要使用正确的cookie解析机制。背景是什么?您尝试过哪些解决方案?什么不起作用?你有没有你可以看一下这篇文章。