草庐IT

cookie-path

全部标签

c# - 在 Windows Phone 上保留 HTTPOnly cookie

我有一个通过HTTPS向API发送用户名和密码的应用程序。API返回HTTPOnlycookie。这意味着cookie对代码“不可见”,但仍然存在并将在后续请求中发送到服务器。Set-Cookieheader从HttpWebResponse.Headers中剥离,cookie不会出现在HttpWebResponse.Cookie或HttpWebRequest.CookieContainer。但是,如果使用相同的HttpWebRequest.CookieContainer发出后续请求,它们将被发送到服务器,但代码无法访问它们。据我所知,这使得它们无法以任何方式序列化或保存。似乎唯一的方法

c# - mscorlib.dll : Access to the path . 中发生类型为 'System.UnauthorizedAccessException' 的未处理异常。被拒绝

我正在尝试将文件写入一个存在的目录,该目录由我在G:\\中创建,即不是系统目录或根驱动器,就像这样File.WriteAllBytes(directoryPath.Replace("wav","mp3"),asBytesArray);但这给我抛出了这个异常:Anunhandledexceptionoftype'System.UnauthorizedAccessException'occurredinmscorlib.dllAdditionalinformation:Accesstothepath'G:\Song'isdenied.我该如何解决这个问题?请帮忙!这是在我从VisualSt

c# - 在重定向页面上执行 GET/POST 时,如何让 HttpWebRequest.AllowAutoRedirect 设置 cookie?

有没有办法让HttpWebRequest对象在通过AllowAutoRedirect功能自动重定向到另一个页面时考虑set-cookieheader?我需要它来维护跨重定向的cookie信息;如果框架可以为我执行此操作,我宁愿不必自己执行重定向。这一定是一个常见的请求,因为我见过的大多数登录页面通常都会这样做。 最佳答案 我知道要使单独的请求(即不同的HttpRequest对象)使用cookie,您需要设置HttpRequest.CookieContainer对CookieContainer的同一实例的两个请求的属性.对于这种情况,

c# - 我应该使用 Path.GetRandomFileName 还是使用 Guid?

我需要生成唯一的文件夹名称,我应该使用Path.GetRandomFileName吗?或者只使用Guid.NewGuid?Guids说它们是全局唯一的,GetRandomFileName并没有这样的说法。 最佳答案 我认为两者都是随机的,不同之处在于Path.GetRandomFileName将生成一个8.3文件名(总共11个字符),因此与由Guid.NewGuid. 关于c#-我应该使用Path.GetRandomFileName还是使用Guid?,我们在StackOverflow上找

c# - 用户代理导致 MVC DisplayFor ArgumentException : Illegal characters in path

我遇到一个问题,移动设备上的用户在MVC中遇到错误,而在普通桌面上查看网站时不会发生这种错误。通过使用Chrome的开发者工具并应用任何其他非默认UA,我可以始终如一地重现错误。抛出的底层异常是:ArgumentException:Illegalcharactersinpath.atSystem.IO.Path.CheckInvalidPathChars(Stringpath,BooleancheckAdditional)atSystem.IO.Path.GetExtension(Stringpath)atSystem.Web.WebPages.DefaultDisplayMode.T

c# - 管理 Application Insights Cookie

我想知道应用程序洞察力如何与cookie一起使用,因为我想了解用户和session跟踪,所以我一直在研究并...这里简单介绍一下这个理论:WheneverApplicationInsightsSDKgetarequestthatdoesn’thaveapplicationinsightsusertrackingcookie(setbyApplicationInsightsJSsnippet)itwillsetthiscookieandstartanewsession.(fromapmtips)2.UserTelemetryInitializerupdatestheIdandAcquis

c# Directory.CreateDirectory( path ),我应该先检查路径是否存在吗?

我需要将一些文件复制到目录中,但有时该目录不存在,必须先创建。大多数情况下,该目录将存在,因为它只需创建一次。我知道我可以将Directory.CreateDirectory()放在文件副本之前,如果目录已经存在,CreateDirectory()就会返回。stringdestFolder;//pathtodestinationstringsourceFolder;//pathtosourceDirectory.CreateDirectory(destFolder);//thiswillworkevenifdestFolderexistsFile.Copy(sourceFolder+s

c# - 如何删除 CookieContainer 中 1 个域下的 cookie

在System.Net.CookieContainer中如果我想删除某个域名下的所有cookies,怎么办? 最佳答案 你可以这样做。CookieContainerc=newCookieContainer();varcookies=c.GetCookies(newUri("http://www.google.com"));foreach(Cookiecoincookies){co.Expires=DateTime.Now.Subtract(TimeSpan.FromDays(1));}这将使您指定域的所有cookie过期。

c# - Process.Start() 和 PATH 环境变量

我有以下简单的C#应用程序,它只是尝试启动“jconsole.exe”,它在我的机器上位于C:\Programs\jdk16\bin中。usingSystem;usingSystem.Diagnostics;namespacednet{publicclassdnet{staticvoidMain(string[]args){try{Process.Start("jconsole.exe");Console.WriteLine("Success!");}catch(Exceptione){Console.WriteLine("{0}Exceptioncaught.",e);}}}}如果我

c# - 如何在 Web API 授权属性中获取请求 cookie?

在.NET中有两个AuthorizeAttribute类。一个在System.Web.Http命名空间中定义:namespaceSystem.Web.Http{//Summary://Specifiestheauthorizationfilterthatverifiestherequest'sSystem.Security.Principal.IPrincipal.[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method,Inherited=true,AllowMultiple=true)]publicclassAut