- Регистрация
- 23.02.2019
- Сообщения
- 3
- Благодарностей
- 0
- Баллы
- 1
I am working with Zennolab (so c#). I am trying to save Cookies:
Now whenn I run it I get this error:
BUt when when I import the Cookies it says that the Cookies cant export because of:
Thanks a lot!
Код:
var cookie = instance.GetCookie();
var splited = cookie.Split(new []{"\r\n"}, StringSplitOptions.None)
.Select(s => s.Split('\t')).Where(w => w.Length >= 6)
.ToArray();
var result = new List<object>();
var locale = new System.Globalization.CultureInfo("de-DE");
var baseDt = DateTime.Now.ToString("MM/dd/yyyy");
foreach (var par in splited)
result.Add(new {
domain = par[0],
expirationDate = (long)(DateTime.Parse(par[4], locale) - baseDt).TotalSeconds,
httpOnly = par[1] == "TRUE",
name = par[5],
path = par[2],
secure = par[3] == "TRUE",
value = par[6]
});
return Global.ZennoLab.Json.JsonConvert.SerializeObject(result);
When I run this Save Cookie Code it is working:Type Time Message 22:19:26 Compile code of Error in action "CS0019" "Operator '-' cannot be applied to operands of type 'System.DateTime' and 'string'". [Row: 10; Column: 33]
Код:
var cookie = instance.GetCookie();
var splited = cookie.Split(new []{"\r\n"}, StringSplitOptions.None)
.Select(s => s.Split('\t')).Where(w => w.Length >= 6)
.ToArray();
var result = new List<object>();
var locale = new System.Globalization.CultureInfo("en-US");
var baseDt = new DateTime(1970, 1, 1);
foreach (var par in splited)
result.Add(new {
domain = par[0],
expirationDate = (long)(DateTime.Parse(par[4], locale) - baseDt).TotalSeconds,
httpOnly = par[1] == "TRUE",
name = par[5],
path = par[2],
secure = par[3] == "TRUE",
value = par[6]
});
return Global.ZennoLab.Json.JsonConvert.SerializeObject(result);
What can I do?Error: Type error for parameter details (Error processing expirationDate: NaN and infinity are not valid) for cookies.set
Thanks a lot!