Hi
I made a naff web application which uses the impersonation method in MSDN
(can't find it now, but it basically revolves around creating a token by
calling the LogonUser API, calling DuplicateToken API on it, and then calling
w.Impersonate() where w is a System.Security.Principal.WindowsIdentity
object). This is the only real point of the said web application if I'm
brutally honest with myself ;-) however it leaves me curious, as does any
test project!
I set up this web application, the idea of which being to shell commands on
the web server and see the output in a webforms text box, from a remote
machine.
I thought the impersonation worked because all the return values were as
expected, and what's more a totally independent Environment.UserName function
returned the username I had impersonated. However, when I try to do
"dir "c:\documents and settings\bonj\*.txt" /b /s
from the web application, it returns 'file not found' but when I copy that
command into a DOS box (logged on as bonj) it returns a whole list of text
files. I'm suspicous that there's some permissions thing that windows is
hiding from me. What, though?
The code for the impersonation is this:
Public Class Impersonator
Implements IDisposable
Const LOGON32_LOGON_INTERACTIVE As Int32 = 2
Const LOGON32_PROVIDER_DEFAULT As Int32 = 0
Const SecurityImpersonation As Int32 = 2
Dim impersonationContext As WindowsImpersonationContext
Declare Auto Function LogonUser Lib "advapi32.dll" (ByVal lpszUserName
As String, _
ByVal lpszDomain As String, _
ByVal lpszPassword As String, _
ByVal dwLogonType As Int32, _
ByVal dwLogonProvider As Int32, _
ByRef phToken As IntPtr) As Int32
Declare Auto Function DuplicateToken Lib "advapi32.dll" _
(ByVal ExistingTokenHandle As IntPtr, _
ByVal ImpersonationLevel As Int32, _
ByRef DuplicateTokenHandle As IntPtr) As Int32
Public Function Impersonate(ByVal UserName As String, ByVal Domain As
String, ByVal Password As String) As Boolean
Dim tempWindowsIdentity As WindowsIdentity
Dim token As IntPtr
Dim tokenDuplicate As IntPtr
If LogonUser(UserName, Domain, password, LOGON32_LOGON_INTERACTIVE, _
LOGON32_PROVIDER_DEFAULT, token) <> 0 Then
If DuplicateToken(token, 2, tokenDuplicate) <> 0 Then
tempWindowsIdentity = New WindowsIdentity(tokenDuplicate)
impersonationContext = tempWindowsIdentity.Impersonate()
Return Not (impersonationContext Is Nothing)
End If
End If
End Function
Public Sub Dispose() Implements System.IDisposable.Dispose
If Not impersonationContext Is Nothing Then
impersonationContext.Undo()
End Sub
End Class
and the code for the cmdCommand click button on the web form is:
Private Sub cmdGo_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdGo.Click
txtResults.Text = ""
Dim p As New Process
Dim psi As New
ProcessStartInfo(Environment.GetEnvironmentVariabl e("comspec"), _
"/c """ + txtCommand.Text + """")
psi.UseShellExecute = False
psi.CreateNoWindow = True
psi.RedirectStandardOutput = True
psi.RedirectStandardError = True
psi.WindowStyle = ProcessWindowStyle.Hidden
p.StartInfo = psi
p.Start()
Dim s As String, err As String
Do
s = p.StandardOutput.ReadLine
err = p.StandardError.ReadLine
If Not s Is Nothing Then txtResults.Text += s + Environment.NewLine
If Not err Is Nothing Then txtResults.Text += err +
Environment.NewLine
Loop Until s Is Nothing
p.Dispose()
End Sub 7 1124
See this it should help:- http://www.developer.com/security/article.php/3065031
"Bonj" <Bo**@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.com... Hi I made a naff web application which uses the impersonation method in MSDN (can't find it now, but it basically revolves around creating a token by calling the LogonUser API, calling DuplicateToken API on it, and then
calling w.Impersonate() where w is a System.Security.Principal.WindowsIdentity object). This is the only real point of the said web application if I'm brutally honest with myself ;-) however it leaves me curious, as does any test project!
I set up this web application, the idea of which being to shell commands
on the web server and see the output in a webforms text box, from a remote machine. I thought the impersonation worked because all the return values were as expected, and what's more a totally independent Environment.UserName
function returned the username I had impersonated. However, when I try to do "dir "c:\documents and settings\bonj\*.txt" /b /s from the web application, it returns 'file not found' but when I copy that command into a DOS box (logged on as bonj) it returns a whole list of text files. I'm suspicous that there's some permissions thing that windows is hiding from me. What, though?
The code for the impersonation is this:
Public Class Impersonator Implements IDisposable
Const LOGON32_LOGON_INTERACTIVE As Int32 = 2 Const LOGON32_PROVIDER_DEFAULT As Int32 = 0 Const SecurityImpersonation As Int32 = 2
Dim impersonationContext As WindowsImpersonationContext
Declare Auto Function LogonUser Lib "advapi32.dll" (ByVal lpszUserName As String, _ ByVal lpszDomain As String, _ ByVal lpszPassword As String, _ ByVal dwLogonType As Int32, _ ByVal dwLogonProvider As Int32, _ ByRef phToken As IntPtr) As Int32 Declare Auto Function DuplicateToken Lib "advapi32.dll" _ (ByVal ExistingTokenHandle As IntPtr, _ ByVal ImpersonationLevel As Int32, _ ByRef DuplicateTokenHandle As IntPtr) As Int32
Public Function Impersonate(ByVal UserName As String, ByVal Domain As String, ByVal Password As String) As Boolean
Dim tempWindowsIdentity As WindowsIdentity Dim token As IntPtr Dim tokenDuplicate As IntPtr
If LogonUser(UserName, Domain, password,
LOGON32_LOGON_INTERACTIVE, _ LOGON32_PROVIDER_DEFAULT, token) <> 0 Then If DuplicateToken(token, 2, tokenDuplicate) <> 0 Then tempWindowsIdentity = New WindowsIdentity(tokenDuplicate) impersonationContext = tempWindowsIdentity.Impersonate() Return Not (impersonationContext Is Nothing) End If End If End Function
Public Sub Dispose() Implements System.IDisposable.Dispose If Not impersonationContext Is Nothing Then impersonationContext.Undo() End Sub End Class
and the code for the cmdCommand click button on the web form is:
Private Sub cmdGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGo.Click txtResults.Text = "" Dim p As New Process Dim psi As New ProcessStartInfo(Environment.GetEnvironmentVariabl e("comspec"), _ "/c """ + txtCommand.Text + """") psi.UseShellExecute = False psi.CreateNoWindow = True psi.RedirectStandardOutput = True psi.RedirectStandardError = True psi.WindowStyle = ProcessWindowStyle.Hidden p.StartInfo = psi p.Start() Dim s As String, err As String Do s = p.StandardOutput.ReadLine err = p.StandardError.ReadLine If Not s Is Nothing Then txtResults.Text += s +
Environment.NewLine If Not err Is Nothing Then txtResults.Text += err + Environment.NewLine Loop Until s Is Nothing p.Dispose() End Sub
Hi,
Well, the error is correct - there is no executable named "dir" (or dir.exe
or dir.bat etc) in the path. You should execute cmd.exe and then pass "dir"
as argument.
Another point is that the System.IO namespace has ready classes that make
one's life easier when in need to work with the filesystem (eg the static
method GetFiles(string, string) of the System.IO.Directory class returns the
results in the most convinient format - a string array; see: http://msdn.microsoft.com/library/en...FilesTopic.asp)
Greetings
Martin
"Bonj" <Bo**@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.com... Hi I made a naff web application which uses the impersonation method in MSDN (can't find it now, but it basically revolves around creating a token by calling the LogonUser API, calling DuplicateToken API on it, and then
calling w.Impersonate() where w is a System.Security.Principal.WindowsIdentity object). This is the only real point of the said web application if I'm brutally honest with myself ;-) however it leaves me curious, as does any test project!
I set up this web application, the idea of which being to shell commands
on the web server and see the output in a webforms text box, from a remote machine. I thought the impersonation worked because all the return values were as expected, and what's more a totally independent Environment.UserName
function returned the username I had impersonated. However, when I try to do "dir "c:\documents and settings\bonj\*.txt" /b /s from the web application, it returns 'file not found' but when I copy that command into a DOS box (logged on as bonj) it returns a whole list of text files. I'm suspicous that there's some permissions thing that windows is hiding from me. What, though?
The code for the impersonation is this:
Public Class Impersonator Implements IDisposable
Const LOGON32_LOGON_INTERACTIVE As Int32 = 2 Const LOGON32_PROVIDER_DEFAULT As Int32 = 0 Const SecurityImpersonation As Int32 = 2
Dim impersonationContext As WindowsImpersonationContext
Declare Auto Function LogonUser Lib "advapi32.dll" (ByVal lpszUserName As String, _ ByVal lpszDomain As String, _ ByVal lpszPassword As String, _ ByVal dwLogonType As Int32, _ ByVal dwLogonProvider As Int32, _ ByRef phToken As IntPtr) As Int32 Declare Auto Function DuplicateToken Lib "advapi32.dll" _ (ByVal ExistingTokenHandle As IntPtr, _ ByVal ImpersonationLevel As Int32, _ ByRef DuplicateTokenHandle As IntPtr) As Int32
Public Function Impersonate(ByVal UserName As String, ByVal Domain As String, ByVal Password As String) As Boolean
Dim tempWindowsIdentity As WindowsIdentity Dim token As IntPtr Dim tokenDuplicate As IntPtr
If LogonUser(UserName, Domain, password,
LOGON32_LOGON_INTERACTIVE, _ LOGON32_PROVIDER_DEFAULT, token) <> 0 Then If DuplicateToken(token, 2, tokenDuplicate) <> 0 Then tempWindowsIdentity = New WindowsIdentity(tokenDuplicate) impersonationContext = tempWindowsIdentity.Impersonate() Return Not (impersonationContext Is Nothing) End If End If End Function
Public Sub Dispose() Implements System.IDisposable.Dispose If Not impersonationContext Is Nothing Then impersonationContext.Undo() End Sub End Class
and the code for the cmdCommand click button on the web form is:
Private Sub cmdGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGo.Click txtResults.Text = "" Dim p As New Process Dim psi As New ProcessStartInfo(Environment.GetEnvironmentVariabl e("comspec"), _ "/c """ + txtCommand.Text + """") psi.UseShellExecute = False psi.CreateNoWindow = True psi.RedirectStandardOutput = True psi.RedirectStandardError = True psi.WindowStyle = ProcessWindowStyle.Hidden p.StartInfo = psi p.Start() Dim s As String, err As String Do s = p.StandardOutput.ReadLine err = p.StandardError.ReadLine If Not s Is Nothing Then txtResults.Text += s +
Environment.NewLine If Not err Is Nothing Then txtResults.Text += err + Environment.NewLine Loop Until s Is Nothing p.Dispose() End Sub
No, not really - it's mainly about "XML metabase" whatever that is, there is
a little bit about impersonation but it's a brief section about how to do it
via the config file, which is hardcoded and goes against my principles.
Thanks anyway though
Cheers
No, sorry, I'm not actually running that.
I should have explained that:
The name of the process I'm calling is cmd.exe, retrieved by calling
Environment.GetEnvironmentVariable("comspec")
and the argument is
"/c dir "c:\doucuments and ......./s /b"
and that it works perfectly for directories other than my personal one in
"c:\documents and settings", which is why I titled the post "impersonation
...." rather than something to do with shelling processes.
Thanks anyway
Cheers
"Martin Dechev" wrote: Hi,
Well, the error is correct - there is no executable named "dir" (or dir.exe or dir.bat etc) in the path. You should execute cmd.exe and then pass "dir" as argument.
Another point is that the System.IO namespace has ready classes that make one's life easier when in need to work with the filesystem (eg the static method GetFiles(string, string) of the System.IO.Directory class returns the results in the most convinient format - a string array; see: http://msdn.microsoft.com/library/en...FilesTopic.asp)
Greetings Martin "Bonj" <Bo**@discussions.microsoft.com> wrote in message news:33**********************************@microsof t.com... Hi I made a naff web application which uses the impersonation method in MSDN (can't find it now, but it basically revolves around creating a token by calling the LogonUser API, calling DuplicateToken API on it, and then calling w.Impersonate() where w is a System.Security.Principal.WindowsIdentity object). This is the only real point of the said web application if I'm brutally honest with myself ;-) however it leaves me curious, as does any test project!
I set up this web application, the idea of which being to shell commands on the web server and see the output in a webforms text box, from a remote machine. I thought the impersonation worked because all the return values were as expected, and what's more a totally independent Environment.UserName function returned the username I had impersonated. However, when I try to do "dir "c:\documents and settings\bonj\*.txt" /b /s from the web application, it returns 'file not found' but when I copy that command into a DOS box (logged on as bonj) it returns a whole list of text files. I'm suspicous that there's some permissions thing that windows is hiding from me. What, though?
The code for the impersonation is this:
Public Class Impersonator Implements IDisposable
Const LOGON32_LOGON_INTERACTIVE As Int32 = 2 Const LOGON32_PROVIDER_DEFAULT As Int32 = 0 Const SecurityImpersonation As Int32 = 2
Dim impersonationContext As WindowsImpersonationContext
Declare Auto Function LogonUser Lib "advapi32.dll" (ByVal lpszUserName As String, _ ByVal lpszDomain As String, _ ByVal lpszPassword As String, _ ByVal dwLogonType As Int32, _ ByVal dwLogonProvider As Int32, _ ByRef phToken As IntPtr) As Int32 Declare Auto Function DuplicateToken Lib "advapi32.dll" _ (ByVal ExistingTokenHandle As IntPtr, _ ByVal ImpersonationLevel As Int32, _ ByRef DuplicateTokenHandle As IntPtr) As Int32
Public Function Impersonate(ByVal UserName As String, ByVal Domain As String, ByVal Password As String) As Boolean
Dim tempWindowsIdentity As WindowsIdentity Dim token As IntPtr Dim tokenDuplicate As IntPtr
If LogonUser(UserName, Domain, password, LOGON32_LOGON_INTERACTIVE, _ LOGON32_PROVIDER_DEFAULT, token) <> 0 Then If DuplicateToken(token, 2, tokenDuplicate) <> 0 Then tempWindowsIdentity = New WindowsIdentity(tokenDuplicate) impersonationContext = tempWindowsIdentity.Impersonate() Return Not (impersonationContext Is Nothing) End If End If End Function
Public Sub Dispose() Implements System.IDisposable.Dispose If Not impersonationContext Is Nothing Then impersonationContext.Undo() End Sub End Class
and the code for the cmdCommand click button on the web form is:
Private Sub cmdGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGo.Click txtResults.Text = "" Dim p As New Process Dim psi As New ProcessStartInfo(Environment.GetEnvironmentVariabl e("comspec"), _ "/c """ + txtCommand.Text + """") psi.UseShellExecute = False psi.CreateNoWindow = True psi.RedirectStandardOutput = True psi.RedirectStandardError = True psi.WindowStyle = ProcessWindowStyle.Hidden p.StartInfo = psi p.Start() Dim s As String, err As String Do s = p.StandardOutput.ReadLine err = p.StandardError.ReadLine If Not s Is Nothing Then txtResults.Text += s + Environment.NewLine If Not err Is Nothing Then txtResults.Text += err + Environment.NewLine Loop Until s Is Nothing p.Dispose() End Sub Another point is that the System.IO namespace has ready classes that make one's life easier when in need to work with the filesystem (eg the static method GetFiles(string, string) of the System.IO.Directory class returns the results in the most convinient format - a string array; see: http://msdn.microsoft.com/library/en-
I'm not specifically trying to find out what files are on the drive. I'm
just trying to setup a process whereby I can run whatever command I want *on*
my own PC, *from* any other. The "dir" was just an example command, but then
it led me onto this folder permissions thing...
Yeah, yeah, I could use remoting. But, I could just give ASPNET's process
higher permissions. But I don't want to do that. I want to be sure
impersonation works...
us/cpref/html/frlrfSystemIODirectoryClassGetFilesTopic.asp) Greetings Martin "Bonj" <Bo**@discussions.microsoft.com> wrote in message news:33**********************************@microsof t.com... Hi I made a naff web application which uses the impersonation method in MSDN (can't find it now, but it basically revolves around creating a token by calling the LogonUser API, calling DuplicateToken API on it, and then calling w.Impersonate() where w is a System.Security.Principal.WindowsIdentity object). This is the only real point of the said web application if I'm brutally honest with myself ;-) however it leaves me curious, as does any test project!
I set up this web application, the idea of which being to shell commands on the web server and see the output in a webforms text box, from a remote machine. I thought the impersonation worked because all the return values were as expected, and what's more a totally independent Environment.UserName function returned the username I had impersonated. However, when I try to do "dir "c:\documents and settings\bonj\*.txt" /b /s from the web application, it returns 'file not found' but when I copy that command into a DOS box (logged on as bonj) it returns a whole list of text files. I'm suspicous that there's some permissions thing that windows is hiding from me. What, though?
The code for the impersonation is this:
Public Class Impersonator Implements IDisposable
Const LOGON32_LOGON_INTERACTIVE As Int32 = 2 Const LOGON32_PROVIDER_DEFAULT As Int32 = 0 Const SecurityImpersonation As Int32 = 2
Dim impersonationContext As WindowsImpersonationContext
Declare Auto Function LogonUser Lib "advapi32.dll" (ByVal lpszUserName As String, _ ByVal lpszDomain As String, _ ByVal lpszPassword As String, _ ByVal dwLogonType As Int32, _ ByVal dwLogonProvider As Int32, _ ByRef phToken As IntPtr) As Int32 Declare Auto Function DuplicateToken Lib "advapi32.dll" _ (ByVal ExistingTokenHandle As IntPtr, _ ByVal ImpersonationLevel As Int32, _ ByRef DuplicateTokenHandle As IntPtr) As Int32
Public Function Impersonate(ByVal UserName As String, ByVal Domain As String, ByVal Password As String) As Boolean
Dim tempWindowsIdentity As WindowsIdentity Dim token As IntPtr Dim tokenDuplicate As IntPtr
If LogonUser(UserName, Domain, password, LOGON32_LOGON_INTERACTIVE, _ LOGON32_PROVIDER_DEFAULT, token) <> 0 Then If DuplicateToken(token, 2, tokenDuplicate) <> 0 Then tempWindowsIdentity = New WindowsIdentity(tokenDuplicate) impersonationContext = tempWindowsIdentity.Impersonate() Return Not (impersonationContext Is Nothing) End If End If End Function
Public Sub Dispose() Implements System.IDisposable.Dispose If Not impersonationContext Is Nothing Then impersonationContext.Undo() End Sub End Class
and the code for the cmdCommand click button on the web form is:
Private Sub cmdGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGo.Click txtResults.Text = "" Dim p As New Process Dim psi As New ProcessStartInfo(Environment.GetEnvironmentVariabl e("comspec"), _ "/c """ + txtCommand.Text + """") psi.UseShellExecute = False psi.CreateNoWindow = True psi.RedirectStandardOutput = True psi.RedirectStandardError = True psi.WindowStyle = ProcessWindowStyle.Hidden p.StartInfo = psi p.Start() Dim s As String, err As String Do s = p.StandardOutput.ReadLine err = p.StandardError.ReadLine If Not s Is Nothing Then txtResults.Text += s + Environment.NewLine If Not err Is Nothing Then txtResults.Text += err + Environment.NewLine Loop Until s Is Nothing p.Dispose() End Sub
Forgive me if I am misinterpreting what you are saying.
Running an .exe across a network will not cause it to execute on the machine
where the .exe resides. It will still execute on the machine doing the
calling.
There is a tool in the resourcekit that will allow your to start a process
on another machine. (can't remember the name right now)
There is also a way with Windows Script Host to start a process remotely.
Greg I'm not specifically trying to find out what files are on the drive. I'm just trying to setup a process whereby I can run whatever command I want *on* my own PC, *from* any other. The "dir" was just an example command, but then it led me onto this folder permissions thing... Yeah, yeah, I could use remoting. But, I could just give ASPNET's process higher permissions. But I don't want to do that. I want to be sure impersonation works...
Hi,
Impersonation works. Although running executables and starting batches is
possible, it is not recommended doing it from the webserver because it is a
non-interactive execution - there's noone to respond to dialog boxes,
requested input, etc. It is always better if you can perform the tasks you
need using the provided framework classes or in cases when there is nothing
ready use platform invoke.
Greetings
Martin
"Bonj" <Bo**@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com... Another point is that the System.IO namespace has ready classes that
make one's life easier when in need to work with the filesystem (eg the
static method GetFiles(string, string) of the System.IO.Directory class returns
the results in the most convinient format - a string array; see: http://msdn.microsoft.com/library/en- I'm not specifically trying to find out what files are on the drive. I'm just trying to setup a process whereby I can run whatever command I want
*on* my own PC, *from* any other. The "dir" was just an example command, but
then it led me onto this folder permissions thing... Yeah, yeah, I could use remoting. But, I could just give ASPNET's process higher permissions. But I don't want to do that. I want to be sure impersonation works...
us/cpref/html/frlrfSystemIODirectoryClassGetFilesTopic.asp) Greetings Martin "Bonj" <Bo**@discussions.microsoft.com> wrote in message news:33**********************************@microsof t.com... Hi I made a naff web application which uses the impersonation method in
MSDN (can't find it now, but it basically revolves around creating a token
by calling the LogonUser API, calling DuplicateToken API on it, and then calling w.Impersonate() where w is a System.Security.Principal.WindowsIdentity object). This is the only real point of the said web application if
I'm brutally honest with myself ;-) however it leaves me curious, as does
any test project!
I set up this web application, the idea of which being to shell
commands on the web server and see the output in a webforms text box, from a
remote machine. I thought the impersonation worked because all the return values were
as expected, and what's more a totally independent Environment.UserName function returned the username I had impersonated. However, when I try to do "dir "c:\documents and settings\bonj\*.txt" /b /s from the web application, it returns 'file not found' but when I copy
that command into a DOS box (logged on as bonj) it returns a whole list of
text files. I'm suspicous that there's some permissions thing that windows
is hiding from me. What, though?
The code for the impersonation is this:
Public Class Impersonator Implements IDisposable
Const LOGON32_LOGON_INTERACTIVE As Int32 = 2 Const LOGON32_PROVIDER_DEFAULT As Int32 = 0 Const SecurityImpersonation As Int32 = 2
Dim impersonationContext As WindowsImpersonationContext
Declare Auto Function LogonUser Lib "advapi32.dll" (ByVal
lpszUserName As String, _ ByVal lpszDomain As String, _ ByVal lpszPassword As String, _ ByVal dwLogonType As Int32, _ ByVal dwLogonProvider As Int32, _ ByRef phToken As IntPtr) As Int32 Declare Auto Function DuplicateToken Lib "advapi32.dll" _ (ByVal ExistingTokenHandle As IntPtr, _ ByVal ImpersonationLevel As Int32, _ ByRef DuplicateTokenHandle As IntPtr) As Int32
Public Function Impersonate(ByVal UserName As String, ByVal Domain
As String, ByVal Password As String) As Boolean
Dim tempWindowsIdentity As WindowsIdentity Dim token As IntPtr Dim tokenDuplicate As IntPtr
If LogonUser(UserName, Domain, password, LOGON32_LOGON_INTERACTIVE, _ LOGON32_PROVIDER_DEFAULT, token) <> 0 Then If DuplicateToken(token, 2, tokenDuplicate) <> 0 Then tempWindowsIdentity = New
WindowsIdentity(tokenDuplicate) impersonationContext =
tempWindowsIdentity.Impersonate() Return Not (impersonationContext Is Nothing) End If End If End Function
Public Sub Dispose() Implements System.IDisposable.Dispose If Not impersonationContext Is Nothing Then impersonationContext.Undo() End Sub End Class
and the code for the cmdCommand click button on the web form is:
Private Sub cmdGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGo.Click txtResults.Text = "" Dim p As New Process Dim psi As New ProcessStartInfo(Environment.GetEnvironmentVariabl e("comspec"), _ "/c """ + txtCommand.Text + """") psi.UseShellExecute = False psi.CreateNoWindow = True psi.RedirectStandardOutput = True psi.RedirectStandardError = True psi.WindowStyle = ProcessWindowStyle.Hidden p.StartInfo = psi p.Start() Dim s As String, err As String Do s = p.StandardOutput.ReadLine err = p.StandardError.ReadLine If Not s Is Nothing Then txtResults.Text += s + Environment.NewLine If Not err Is Nothing Then txtResults.Text += err + Environment.NewLine Loop Until s Is Nothing p.Dispose() End Sub
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Anil Krishnamurthy |
last post by:
We have an ASP.NET application that uses COM objects through Interop. The
web application requires access to network and database resources and hence,
needs to impersonate a domain account. The...
|
by: techfuzz |
last post by:
I'm posting my problem experience and solution I found here for other
ASP.NET developers.
I have a web application that uses Forms Authentication with Active
Directory to control access. In...
|
by: Peter Afonin |
last post by:
Hello:
When I try to access a SQL server or a network share from an ASP.Net
application that I run on my computer, I run into security problems (for
instance, I cannot execute DTS package using...
|
by: cjk |
last post by:
Issue
Our web application requires access to write to a custom event log, yet access is denied. This access is denied because we are using impersonation, and our end-users do not (should not) have...
|
by: Wm. Scott Miller |
last post by:
What is the difference between using a username and password in the
processmodel section vs using one in impersonation in the machine.config
file? What are the advantages of each and what are the...
|
by: Bonj |
last post by:
Hi
I made a naff web application which uses the impersonation method in MSDN
(can't find it now, but it basically revolves around creating a token by
calling the LogonUser API, calling...
|
by: Jake Smythe |
last post by:
Hello,
I have some code that impersonates a user upon launching of the
application. We now have the need to run some command line items. The
impersonation doesn't seem to pass to the commands...
|
by: Patrick |
last post by:
I have an ASP.NET web service whose Web.Config is set to use impersonation
<authentication mode="Windows" />
<identity impersonate="true" />
Within a Web Method, I want to use...
|
by: zhuang |
last post by:
Dear all,
I found a very interesting thing about viewing crystal report (located
on network drive) with asp.net application.
To do the impersonation, modify web.config does not work, you have...
|
by: Arpan |
last post by:
The .NET2 documentation defines impersonation as thus:
----------
When using Impersonation, ASP.NET applications can execute with the
Windows identity (user account) of the user making the...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |