Problem starting windows forms application from ASP.Net 2.0



Hi !

I'm having trouble starting desktop windows forms application with gui.
So far i have managed to make it run when I access website on local
computer,
trying to start application from any other machine fails.

I have modified machine.config process model as follows:
<processModel autoConfig="true" userName="SYSTEM" password="AutoGenerate" />

Now aspnet worker process is running under SYSTEM account.

Im using Windows authentication and Im impersonating currently logged user
so my web config contains:
<authentication mode="Windows" />
<identity impersonate="true" />

Platform is Windows XP and User is automatically logged in to desktop.

Code for starting process is below...

Please tell me what am I doing wrong, point me in right direction, thank you
!

Goran


Code:
private bool NativeProcessStart()
{
string locError = string.Empty;
// Impersonation constants
const uint GENERIC_ALL = 0x10000000;
const int SecurityImpersonation = 2;
const int TokenType = 1;
IntPtr Token = new IntPtr(0);
IntPtr DupedToken = new IntPtr(0);
bool ret;

// Init sceurity attribures struct
SECURITY_ATTRIBUTES sa = new SECURITY_ATTRIBUTES();
sa.bInheritHandle = false;
sa.Length = Marshal.SizeOf(sa);
sa.lpSecurityDescriptor = (IntPtr)0;

// Get Impersonated user token
Token = WindowsIdentity.GetCurrent().Token;
// Duplicate Impersonated user token
ret = DuplicateTokenEx(Token,GENERIC_ALL,ref
sa,SecurityImpersonation,TokenType,ref DupedToken);
if (false == ret)
{
return ret;
}

STARTUPINFO si = new STARTUPINFO();
si.cb = Marshal.SizeOf(si);
si.lpDesktop = "";
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();

ret = CreateProcessAsUser(DupedToken, null,
this._playerPath + " " + this._playerParams, ref sa, ref sa, false, 0,
(IntPtr)0,
System.IO.Path.GetDirectoryName(this._playerPath),ref si,out pi);

if (false == ret)
{
return ret;
}

CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
ret = CloseHandle(DupedToken);
return ret;
}


.