English 中文(简体)
C#的标志使用者之后的伐木
原标题:Logoff after logonuser on C#

I use advapi32.dll s logonuser method to access data over our network.
I know it change the thread s user to the information i give it, but i was wondering if there s a way to reverse it.
I want to access the data and then return to the local user credentials.

最佳回答

一段时间前,我创建了http://www.codeproject.com/KB/cs/zetaimpersonator.aspx>。 小型蜂窝类。

基本上,你在《<<<>条/代码>的<条码>内,在另一个用户下执行你的代码。 页: 1

using ( new Impersonator( "myUsername", "myDomainname", "myPassword" ) )
{
   ...

   <code that executes under the new context>

   ...
}

对我的项目工作做得很好。

问题回答

http://msdn.microsoft.com/en-us/library/a3793 1728v=VS.85%29.aspx”rel=“nofollow”Revert To Self

尽管如此,还需要说的是,为冒犯任务打下了全心全意的准备,并在冒犯工作完成时终止。 这将使冒名工作分离开来,这样,如果在主线上处理任何反馈或信息,就会在主要用户而不是冒名用户的情况下进行。 事实上,我越是想到这一点,越是越强,我就越认为,一个全心全意的解决方案。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签