草庐IT

thread_local

全部标签

c# - http.context.user 和 thread.currentprincipal 之间的区别以及何时使用它们?

我最近遇到了在visualstudio2008下运行asp.netweb应用程序的问题。我收到错误“typeisnotresolvedformember...customUserPrincipal”。追踪各种讨论组发现,当您针对Thread.CurrentPrincipal分配自定义主体时,VisualStudio的Web服务器似乎存在问题。在我的代码中,我现在使用...HttpContext.Current.User=myCustomPrincipal//Thread.CurrentPrincipal=myCustomPrincipal我很高兴我排除了错误,但它回避了“这两种设置委托

c# - http.context.user 和 thread.currentprincipal 之间的区别以及何时使用它们?

我最近遇到了在visualstudio2008下运行asp.netweb应用程序的问题。我收到错误“typeisnotresolvedformember...customUserPrincipal”。追踪各种讨论组发现,当您针对Thread.CurrentPrincipal分配自定义主体时,VisualStudio的Web服务器似乎存在问题。在我的代码中,我现在使用...HttpContext.Current.User=myCustomPrincipal//Thread.CurrentPrincipal=myCustomPrincipal我很高兴我排除了错误,但它回避了“这两种设置委托

c# - 如何将 user.config 保存到 AppData\Roaming 文件夹而不是 AppData\Local?

介绍性示例这段代码Properties.Settings.Default.MyUserSettingBlah="somenewvalue";Properties.Settings.Default.Save();将user.config文件保存到C:\Users\MyUserName\AppData\Local\My_Company_Name\MyApp_Url_vb2s5kwidefdmxstmabckatcyl5t0lxd\1.0.0.0\user.config问题如何将user.config保存到C:\Users\MyUserName\AppData\漫游\...代替C:\User

c# - 如何将 user.config 保存到 AppData\Roaming 文件夹而不是 AppData\Local?

介绍性示例这段代码Properties.Settings.Default.MyUserSettingBlah="somenewvalue";Properties.Settings.Default.Save();将user.config文件保存到C:\Users\MyUserName\AppData\Local\My_Company_Name\MyApp_Url_vb2s5kwidefdmxstmabckatcyl5t0lxd\1.0.0.0\user.config问题如何将user.config保存到C:\Users\MyUserName\AppData\漫游\...代替C:\User

c# - 检查路径输入是URL还是Local File

我在xmldataprovider中工作,我们有配置值“源”,这个值可能是本地文件或url喜欢c:\data\test.xml--absolutedata\test.xml--relativeorurlhttp:\mysite\test.xml我如何在代码中确定所有这些情况我在用c# 最佳答案 privatestaticboolIsLocalPath(stringp){returnnewUri(p).IsFile;}...或者,如果您想包含对某些无效URI的支持...privatestaticboolIsLocalPath(stri

c# - 检查路径输入是URL还是Local File

我在xmldataprovider中工作,我们有配置值“源”,这个值可能是本地文件或url喜欢c:\data\test.xml--absolutedata\test.xml--relativeorurlhttp:\mysite\test.xml我如何在代码中确定所有这些情况我在用c# 最佳答案 privatestaticboolIsLocalPath(stringp){returnnewUri(p).IsFile;}...或者,如果您想包含对某些无效URI的支持...privatestaticboolIsLocalPath(stri

解决(图文详解):ERROR: Cannot unpack file C:\Users\xxx\AppData\Local\Temp\pip-unpack-_vck1vr6\simple

安装python时候出现问题:ERROR:CannotunpackfileC:\Users\xxx\AppData\Local\Temp\pip-unpack-_vck1vr6\simple(downloadedfromC:\Users\xxx\AppData\Local\Temp\pip-req-build-sgcwvrkt,content-type:text/html;charset=utf-8);cannotdetectarchiveformatERROR:CannotdeterminearchiveformatofC:\Users\xxx\AppData\Local\Temp\pip-

c# - System.Timers.Timer 与 System.Threading.Timer 的线程安全

在本文中:http://msdn.microsoft.com/en-us/magazine/cc164015.aspx作者声明System.Threading.Timer不是线程安全的。从那时起,这在博客上、Richter的书“CLRviaC#”和SO中都重复了这一点,但这从来没有被证明是合理的。此外MSDNdocumentation确保“这种类型是线程安全的。”1)谁说的是真话?2)如果这是原始文章,是什么让System.Threading.Timer不是线程安全的,以及它的包装器System.Timers.Timer如何实现更多的线程安全?谢谢 最佳答案

c# - System.Timers.Timer 与 System.Threading.Timer 的线程安全

在本文中:http://msdn.microsoft.com/en-us/magazine/cc164015.aspx作者声明System.Threading.Timer不是线程安全的。从那时起,这在博客上、Richter的书“CLRviaC#”和SO中都重复了这一点,但这从来没有被证明是合理的。此外MSDNdocumentation确保“这种类型是线程安全的。”1)谁说的是真话?2)如果这是原始文章,是什么让System.Threading.Timer不是线程安全的,以及它的包装器System.Timers.Timer如何实现更多的线程安全?谢谢 最佳答案

c# - 如何在 C# 中获取当前用户的 Local Settings 文件夹路径?

我想将文件对话框指向Windows上当前用户的“本地设置”文件夹中的特定文件夹。获取这条路径的捷径是什么? 最佳答案 这个怎么样,比如:StringappData=Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);我没有看到仅本地设置文件夹的枚举。http://web.archive.org/web/20080303235606/http://dotnetjunkies.com/WebLog/nenoloje/archive/2007/