本文介绍了如何在控制台应用程序中设置cookie并在IE11中打开URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我尝试使用C#console应用程序在IE11上打开URL。没关系,但我还想在IE11上打开该URL之前设置cookie。我看到了这个 问题并完全按照答案给出 这里我的代码在main()内部Hi,I am try to open URL on IE11 using C# console application. It is OK but I also want to set the cookie before open that URL on IE11. I saw this question and do exactly as given in answerhere my code in inside main()if (InternetSetCookie(webUrl, "mycookie1", "myCookieValue")){ Console.WriteLine("1st Cookie is sucessfully created.");}if(IESetProtectedModeCookie(webUrl, "mycookie2", "data=mycookiedata; expires = " + DateTime.UtcNow.AddDays(1).ToString() + "; path=/", 0x10)){ Console.WriteLine("2nd Cookie is sucessfully created.");}Process.Start("IExplore.exe", webUrl); 两种方法都返回true并显示消息。但是当我尝试通过键入document.cookie使用开发人员工具控制台在IE11上查看cookie时,会出现未定义的消息。请帮助我。both methods are return true and display the messages. But when I try to see the cookie on IE11 using developer tool console by typing document.cookie then undefined message occur. Please help me.推荐答案 这篇关于如何在控制台应用程序中设置cookie并在IE11中打开URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!