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

  • Home
  • SEARCH
  • 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
  • 0 Views
  • 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

Ask A Question

Stats

  • Questions 69k
  • Answers 69k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I found the answer to this through the a blog… May 11, 2026 at 12:42 pm
  • added an answer As long as your server is setting a cookie within… May 11, 2026 at 12:42 pm
  • added an answer SELECT * FROM ( SELECT * FROM mytable ORDER BY… May 11, 2026 at 12:42 pm

Related Questions

I have a problem with stopping a service and starting it again and want
I have problem with return statment >.< I want to store all magazine names
I have problem with ActionLink. I'd like to pass to my ActionLink parameter for
I have a problem with a little .Net web application which uses the Amazon
I want to kill a process programmatically in vista/windows 7 (I'm not sure if
Looking for some direction here as I'm running into some migration problems. We have
I have a process in a website (Asp.net 3.5 using Linq-to-Sql for data access)

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.