Invalid part in cookie
Public Sub SetCsdnCookie(ByVal c1 As System.Net.CookieContainer)
Dim s As String = " buildtime=2004%2D2%2D3+13%3A44%fsadfasd; buildnum=1; test=0; ASPSESSIONIDQASRTDQB=EKPHCECANFKHBJLMNJEDOJDP; ASPSESSIONIDQAQSSCQA=IALDDLCAJNGDPHDLFHOCGPLD; ASPSESSIONIDSCQRSDQA=JBCKJPDADKFLJDLAPFHLBIND; daynum=7; ABCDEF=RyYqs5wAA1v7wvlXC%25252fgOhElDWk%25252fVqNFDM3t306oQtpV5vj76WrVjh7ZInURppl6i; QWERTOP=1682; userid=78486"
'Dim s As String = "UserName=Montaque ; IP=12.121.1.1"
s = s.Trim
Dim reg1 As New System.Text.RegularExpressions.Regex("(?<1>[^=]+)=(?<2>[^=]+);")
Dim mc As System.Text.RegularExpressions.MatchCollection = reg1.Matches(s)
Dim cc As New System.Net.CookieCollection
Dim cookie1 As System.Net.Cookie
For Each m As System.Text.RegularExpressions.Match In mc
cookie1 = New System.Net.Cookie(m.Groups(1).Value, m.Groups(2).Value)
cookie1.Domain = sUrl
cc.Add(cookie1)
Next
Console.ReadLine()
c1.Add(cc)
End Sub
//How to Resolve.
name and value of a cookie can not begin with spaces,so add a trim to the name and value