impersonation

“Cannot open log for source” - Windows 7 - .NET web service - event log

☆樱花仙子☆ 提交于 2019-12-23 01:09:10
问题 I have a .NET web service that is trying to log to the Windows Event Log. However, when I try to send a SOAP request to a web method in this web service, I get back this error in the SOAP response: System.InvalidOperationException: Cannot open log for source 'MySource'. You may not have write access. ---> System.ComponentModel.Win32Exception: Access is denied I've tried Googling around for a solution. This one describes editing a registry key that does not exist for me in Windows 7 64-bit;

VB.Net File.Copy/File.Move with different credentials

只愿长相守 提交于 2019-12-22 14:08:45
问题 Ideally I'd like to be able to copy/move between an accessible folder on my local drive and a network share that I don't have permission to access (but the application would). I am using impersonation to give me access to the files in the network share but using System.IO File.Move or File.Copy forces me to use the same credentials for each location. Is there a way around this? 回答1: What I believe you could do is something like this. Do the impersonation to allow the selection of files. Copy

VB.Net File.Copy/File.Move with different credentials

瘦欲@ 提交于 2019-12-22 14:08:21
问题 Ideally I'd like to be able to copy/move between an accessible folder on my local drive and a network share that I don't have permission to access (but the application would). I am using impersonation to give me access to the files in the network share but using System.IO File.Move or File.Copy forces me to use the same credentials for each location. Is there a way around this? 回答1: What I believe you could do is something like this. Do the impersonation to allow the selection of files. Copy

Automatically set up user's subscription in SSRS

荒凉一梦 提交于 2019-12-22 10:49:43
问题 I have a very simple report in SSRS that is just a table with three columns, an object name, client account, and expiration date. In my report, I include a filter by UserID to limit the data to just the logged in user's client accounts. I store the user's client accounts in a simple table with domain\alias | client account fields which is populated from a SSIS package. When a new alias | client account association is entered, I would also like to set up a subscription to the report for this

how to save file in another machine in the same network in c#?

喜夏-厌秋 提交于 2019-12-22 10:48:36
问题 I have to save the uploaded document into another local machine. But I was not clear how to use impersonation in my code. I have used the following code. protected void btnSave_Click(object sender, EventArgs e) { int result = 0,result1=0; string attachmentpath = "C:\\Documents and Settings\\pr84528\\My Documents\\PRABU\\Tech\\Dot Net\\DocumentManager\\Attachments\\"; .................................................................................... ..........................................

Is it possible to assign roles using the Exchange web services in c#?

走远了吗. 提交于 2019-12-22 08:46:10
问题 Is it possible to assign roles using the Exchange web services in c#? Like you programatically automate of adding the role ApplicationImpersonation and assign the role to the users in Office 365 Exchange? 回答1: Assigning roles using Exchange web services is not possible. If you wish to do this through a C# application, try executing PowerShell cmdlets in C#. Look for "RoleGroup" cmdlets. This thread will give you some examples on how to execute PowerShell in C#: Powershell command through C#

how to use hashed password in impersonate of ASP.NET

别等时光非礼了梦想. 提交于 2019-12-22 08:20:09
问题 I have an ASP.NET application that requires impersonation as an administrator user. In web.config: <identity impersonate="true" userName="administrator" password="password"/> The customer complained about saving the password in clear text format. Is there a way to save the password here as hashed? 回答1: aspnet_regiis with the appropriate switch should do the trick, see this article. 来源: https://stackoverflow.com/questions/2912903/how-to-use-hashed-password-in-impersonate-of-asp-net

How to run PowerShell scripts from C#

孤街浪徒 提交于 2019-12-22 07:36:11
问题 I am trying to run a PowerShell script with C#, but I don't have any success. Here is my function: private void ExecutePowerShellCommand(string scriptfile) { RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create(); Runspace runspace = RunspaceFactory.CreateRunspace(runspaceConfiguration); runspace.Open(); RunspaceInvoke scriptInvoker = new RunspaceInvoke(); scriptInvoker.Invoke("Set-ExecutionPolicy Unrestricted"); Pipeline pipeline = runspace.CreatePipeline(); //Here's

The right use of <identity impersonate=“true”/>

别来无恙 提交于 2019-12-22 03:20:42
问题 In my Website, Users who has logged in are able to change their profile pictures, and this process includes saving the uploaded image to a folder in the website's root directory. When I tested it, I received an Error that I should grant access to this specific folder using permissions. I do not have control over the Control Panel, the one who does said that he did grant the Images folder a READ and WRITE permissions to Others . After Testing it again, once again the same error, so I edited

ASP.NET - temporarily impersonate the app pool service ID when default it to impersonate the user?

岁酱吖の 提交于 2019-12-21 21:18:09
问题 I have to call some code in a SharePoint site that runs under the same service ID that the web application is running under. By default, SharePoint impersonates the user viewing the web page, and the users don't have the necessary permissions. What is the best way to run some code using the web application's service ID, then revert back to using the default impersonation? 回答1: SPSecurity.RunWithElevatedPrivileges 回答2: Nat is right. You should use SPSecurity.RunWithElevatedPrivileges. Under