Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 98383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:11:08+00:00 2026-05-11T00:11:08+00:00

I have problem with starting processes in impersonated context in ASP.NET 2.0. I am

  • 0

I have problem with starting processes in impersonated context in ASP.NET 2.0.

I am starting new Process in my web service code. IIS 5.1, .NET 2.0

[WebMethod] public string HelloWorld() {     string path = @'C:\KB\GetWindowUser.exe';     ProcessStartInfo startInfo = new ProcessStartInfo();     startInfo.WorkingDirectory = Path.GetDirectoryName(path);     startInfo.FileName = path;     startInfo.UseShellExecute = false;     startInfo.CreateNoWindow = true;     startInfo.ErrorDialog = false;     startInfo.RedirectStandardOutput = true;     startInfo.RedirectStandardError = true;     Process docCreateProcess = Process.Start(startInfo);      string errors = docCreateProcess.StandardError.ReadToEnd();     string output = docCreateProcess.StandardOutput.ReadToEnd(); } 

The ‘C:\KB\GetWindowUser.exe’ is console application containing following code:

static void Main(string[] args) {     Console.WriteLine('Windows: ' + WindowsIdentity.GetCurrent().Name); } 

When I invoke web service without impersonation, everything works fine.

When I turn on impersonation, following error is written in ‘errors’ variable in web service code:

Unhandled Exception: System.Security.SecurityException: Access is denied.\r\n\r\n at System.Security.Principal.WindowsIdentity.GetCurrentInternal(TokenAccessLevels desiredAccess, Boolean threadOnly)\r\n at System.Security.Principal.WindowsIdentity.GetCurrent()\r\n at ObfuscatedMdc.Program.Main(String[] args)\r\nThe Zone of the assembly that failed was:\r\nMyComputer

Impersonated user is local administrator and has access to C:\KB\GetWindowUser.exe executable.

When I specify window user explicitly in ProcesStartInfo properties Domain, User and Password, I got following message: http://img201.imageshack.us/img201/5870/pstartah8.jpg

Is it possible to start process with different credentials than ASPNET from asp.net (IIS 5.1) ?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T00:11:09+00:00Added an answer on May 11, 2026 at 12:11 am

    You have to put privileged code into the GAC (or run in Full trust).

    The code in the GAC must assert the XXXPermission, where XXX is what ever permission you are requesting, be it impersonation, access to the harddrive or what have you.

    You should revert the assert immediately afterwords.

    You should make sure that the API on your DLL that you put in the GAC has no opportunities for abuse. For example, if you were writing a website for letting users backup the server via a command line application, your API should old expose a method like ‘BackUp()’ and not ‘LaunchAribitraryProcess(string path)’

    The web.config file must have impersonation set up as well, or you will run into NTFS permission problems as well as CAS.

    Here is the complete explanation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with starting the sunspot server. last week it worked like
I have odd problem: After starting server I got this error: undefined local variable
I am just starting out with JNI and I have a following problem. I
Starting from Android 3.2 I have this strange problem. It's very easy to reproduce:
I am just starting working with jquery and have encountered the following problem <div
I have asp net website with a very slow query on a remote database.
I have a web service, implemented with WCF and hosted in IIS7, with a
I am quite new to C# and threading, and I have this problem to
I have some vb.net code which should print out labels using Teklynx LabelView software
I have developed a simple Apache-Axis java web service using Eclipse IDE and now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.