Showing posts with label machine. Show all posts
Showing posts with label machine. Show all posts

Saturday, March 24, 2012

Permission denied problem. please help me

Hi All,

I am trying to download the file from network machine (under same domain). I
am using below link page code to impersonate.

http://www.netomatix.com/ImpersonateUser.aspx

I can able to impersonate the user, when i try to download the file, its
says "unknown user name and password". I given full permission to domain
user. but the same time when i provied the user name and deails on webconfig
file like below, its allowing me to download.

<identity impersonate="true" userName="mydomain\bala" password="password" /
I dont know where the problem is. Can anyone please give me idea to resolve
this.
I am trying to fix this problem past 3 days.

below is the complete code i am using...

i am getting error on response.writefile. This is the error message

Logon failure: unknown user name or bad password.
exception Details: System.IO.IOException: Logon failure: unknown user name
or bad password.

code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim impContext As WindowsImpersonationContext = Nothing
Try
impContext = NetworkSecurity.ImpersonateUser("mydomain",
"bala", "password", LogonType.LOGON32_LOGON_NETWORK,
LogonProvider.LOGON32_PROVIDER_DEFAULT)
Catch ex As ApplicationException
impContext.Undo()
Response.Write(ex.Message)
End Try
If Not (Nothing Is impContext) Then
Try
Catch ex As Exception
Response.Write(ex.Message)
Finally
impContext.Undo()
If Page.IsPostBack Then
Dim spath As String
spath = "\\laptop02\temp\test.pdf"
'DownloadFile(spath, True)
Dim path1 As String = spath
Dim name As String = Path.GetFileName(path1)

Dim ext As String = Path.GetExtension(path1)
Dim type As String = ""
If Not (ext Is Nothing) Then
Select Case ext.ToLower
Case ".htm", ".html"
type = "text/HTML"
' break
Case ".txt"
type = "text/plain"
' break
Case ".doc", ".rtf"
type = "Application/msword"
' break
Case ".pdf"
type = "Application/pdf"
End Select
End If
'If forceDownload Then
Response.AppendHeader("content-disposition",
"attachment; filename = " & name)
'End If
If Not (type = "") Then
Response.ContentType = type
End If
Response.WriteFile(path1)
Response.End()

End If
End Try
End If
End Sub

thanks
balaImpersonation only allows access to local resources as the user who's using
your site. You want delegation which will allow off-host access as the user
who has authenticated in the browser. In essence it means you need to enable
this in AD for the machine that's running your webserver. Check out this
for more info:

http://pluralsite.com/wiki/default...Delegation.html

-Brock
DevelopMentor
http://staff.develop.com/ballen

> Hi All,
> I am trying to download the file from network machine (under same
> domain). I am using below link page code to impersonate.
> http://www.netomatix.com/ImpersonateUser.aspx
> I can able to impersonate the user, when i try to download the file,
> its says "unknown user name and password". I given full permission to
> domain user. but the same time when i provied the user name and deails
> on webconfig file like below, its allowing me to download.
> <identity impersonate="true" userName="mydomain\bala"
> password="password" />
> I dont know where the problem is. Can anyone please give me idea to
> resolve this. I am trying to fix this problem past 3 days.
> below is the complete code i am using...
> i am getting error on response.writefile. This is the error message
> Logon failure: unknown user name or bad password. exception Details:
> System.IO.IOException: Logon failure: unknown user name or bad
> password.
> code:
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> Dim impContext As WindowsImpersonationContext = Nothing
> Try
> impContext =
> NetworkSecurity.ImpersonateUser("mydomain",
> "bala", "password", LogonType.LOGON32_LOGON_NETWORK,
> LogonProvider.LOGON32_PROVIDER_DEFAULT)
> Catch ex As ApplicationException
> impContext.Undo()
> Response.Write(ex.Message)
> End Try
> If Not (Nothing Is impContext) Then
> Try
> Catch ex As Exception
> Response.Write(ex.Message)
> Finally
> impContext.Undo()
> If Page.IsPostBack Then
> Dim spath As String
> spath = "\\laptop02\temp\test.pdf"
> 'DownloadFile(spath, True)
> Dim path1 As String = spath
> Dim name As String = Path.GetFileName(path1)
> Dim ext As String = Path.GetExtension(path1)
> Dim type As String = ""
> If Not (ext Is Nothing) Then
> Select Case ext.ToLower
> Case ".htm", ".html"
> type = "text/HTML"
> ' break
> Case ".txt"
> type = "text/plain"
> ' break
> Case ".doc", ".rtf"
> type = "Application/msword"
> ' break
> Case ".pdf"
> type = "Application/pdf"
> End Select
> End If
> 'If forceDownload Then
> Response.AppendHeader("content-disposition",
> "attachment; filename = " & name)
> 'End If
> If Not (type = "") Then
> Response.ContentType = type
> End If
> Response.WriteFile(path1)
> Response.End()
> End If
> End Try
> End If
> End Sub
> thanks
> bala
Hi Brock,

Thanks for the reply. The user name which i am using is under the same
DOMAIN.

Are you mentioning the same domain user or local user for that machine?

Thanks
bala

"Brock Allen" wrote:

> Impersonation only allows access to local resources as the user who's using
> your site. You want delegation which will allow off-host access as the user
> who has authenticated in the browser. In essence it means you need to enable
> this in AD for the machine that's running your webserver. Check out this
> for more info:
> http://pluralsite.com/wiki/default...Delegation.html
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
> > Hi All,
> > I am trying to download the file from network machine (under same
> > domain). I am using below link page code to impersonate.
> > http://www.netomatix.com/ImpersonateUser.aspx
> > I can able to impersonate the user, when i try to download the file,
> > its says "unknown user name and password". I given full permission to
> > domain user. but the same time when i provied the user name and deails
> > on webconfig file like below, its allowing me to download.
> > <identity impersonate="true" userName="mydomain\bala"
> > password="password" />
> > I dont know where the problem is. Can anyone please give me idea to
> > resolve this. I am trying to fix this problem past 3 days.
> > below is the complete code i am using...
> > i am getting error on response.writefile. This is the error message
> > Logon failure: unknown user name or bad password. exception Details:
> > System.IO.IOException: Logon failure: unknown user name or bad
> > password.
> > code:
> > Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles Button1.Click
> > Dim impContext As WindowsImpersonationContext = Nothing
> > Try
> > impContext =
> > NetworkSecurity.ImpersonateUser("mydomain",
> > "bala", "password", LogonType.LOGON32_LOGON_NETWORK,
> > LogonProvider.LOGON32_PROVIDER_DEFAULT)
> > Catch ex As ApplicationException
> > impContext.Undo()
> > Response.Write(ex.Message)
> > End Try
> > If Not (Nothing Is impContext) Then
> > Try
> > Catch ex As Exception
> > Response.Write(ex.Message)
> > Finally
> > impContext.Undo()
> > If Page.IsPostBack Then
> > Dim spath As String
> > spath = "\\laptop02\temp\test.pdf"
> > 'DownloadFile(spath, True)
> > Dim path1 As String = spath
> > Dim name As String = Path.GetFileName(path1)
> > Dim ext As String = Path.GetExtension(path1)
> > Dim type As String = ""
> > If Not (ext Is Nothing) Then
> > Select Case ext.ToLower
> > Case ".htm", ".html"
> > type = "text/HTML"
> > ' break
> > Case ".txt"
> > type = "text/plain"
> > ' break
> > Case ".doc", ".rtf"
> > type = "Application/msword"
> > ' break
> > Case ".pdf"
> > type = "Application/pdf"
> > End Select
> > End If
> > 'If forceDownload Then
> > Response.AppendHeader("content-disposition",
> > "attachment; filename = " & name)
> > 'End If
> > If Not (type = "") Then
> > Response.ContentType = type
> > End If
> > Response.WriteFile(path1)
> > Response.End()
> > End If
> > End Try
> > End If
> > End Sub
> > thanks
> > bala
>
>
> Thanks for the reply. The user name which i am using is under the same
> DOMAIN.

Ok, that shouldn't matter with delegation.

> Are you mentioning the same domain user or local user for that
> machine?

For delegation you'll have to be using kerb. The username doesn't matter,
the important thing is to configure the server to be trusted for delegation.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi Brock,

Using this below link code i can able to impersonate the user on my domain
user account. From my locl machine IIS i can able to download the other
machine file, like below path.
("AnotherNetworkMachine\temp\ss.pdf")

But when i place this code my server, the impersonate is doing succuss, but
its taking too much time to download and finally it says page cannot be
displayed error.

any idea.

bala

http://west-wind.com/weblog/posts/1572.aspx

"Brock Allen" wrote:

> > Thanks for the reply. The user name which i am using is under the same
> > DOMAIN.
> Ok, that shouldn't matter with delegation.
> > Are you mentioning the same domain user or local user for that
> > machine?
> For delegation you'll have to be using kerb. The username doesn't matter,
> the important thing is to configure the server to be trusted for delegation.
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
Hi Brock,

If i create a local account on webserver and same username and password for
network machine to local, In this point can i able to download the file?

thanks
bala

"Brock Allen" wrote:

> > Thanks for the reply. The user name which i am using is under the same
> > DOMAIN.
> Ok, that shouldn't matter with delegation.
> > Are you mentioning the same domain user or local user for that
> > machine?
> For delegation you'll have to be using kerb. The username doesn't matter,
> the important thing is to configure the server to be trusted for delegation.
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
sorry. when i run the application on same domain its download the file. but
from outside i am getting error. so that wont work.

bala

"Bala" wrote:

> Hi Brock,
> Using this below link code i can able to impersonate the user on my domain
> user account. From my locl machine IIS i can able to download the other
> machine file, like below path.
> ("AnotherNetworkMachine\temp\ss.pdf")
> But when i place this code my server, the impersonate is doing succuss, but
> its taking too much time to download and finally it says page cannot be
> displayed error.
> any idea.
> bala
> http://west-wind.com/weblog/posts/1572.aspx
> "Brock Allen" wrote:
> > > Thanks for the reply. The user name which i am using is under the same
> > > DOMAIN.
> > Ok, that shouldn't matter with delegation.
> > > Are you mentioning the same domain user or local user for that
> > > machine?
> > For delegation you'll have to be using kerb. The username doesn't matter,
> > the important thing is to configure the server to be trusted for delegation.
> > -Brock
> > DevelopMentor
> > http://staff.develop.com/ballen
On Mon, 29 Aug 2005 13:45:32 -0700, "Bala" <Bala@.discussions.microsoft.com> wrote:

Hi Brock,

If i create a local account on webserver and same username and password for
network machine to local, In this point can i able to download the file?

As Brock was indicating, you need to delegate credentials which requires Kerberos if your web
application is configured for Integrated Windows Security.

How to configure an ASP.NET application for a delegation scenario
http://support.microsoft.com/defaul...kb;en-us;810572

Paul
~~~~
Microsoft MVP (Visual Basic)

Permission denied problem. please help me

Hi All,
I am trying to download the file from network machine (under same domain). I
am using below link page code to impersonate.
http://www.netomatix.com/ImpersonateUser.aspx
I can able to impersonate the user, when i try to download the file, its
says "unknown user name and password". I given full permission to domain
user. but the same time when i provied the user name and deails on webconfig
file like below, its allowing me to download.
<identity impersonate="true" userName="mydomain\bala" password="password" />
I dont know where the problem is. Can anyone please give me idea to resolve
this.
I am trying to fix this problem past 3 days.
below is the complete code i am using...
i am getting error on response.writefile. This is the error message
Logon failure: unknown user name or bad password.
exception Details: System.IO.IOException: Logon failure: unknown user name
or bad password.
code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim impContext As WindowsImpersonationContext = Nothing
Try
impContext = NetworkSecurity.ImpersonateUser("mydomain",
"bala", "password", LogonType.LOGON32_LOGON_NETWORK,
LogonProvider.LOGON32_PROVIDER_DEFAULT)
Catch ex As ApplicationException
impContext.Undo()
Response.Write(ex.Message)
End Try
If Not (Nothing Is impContext) Then
Try
Catch ex As Exception
Response.Write(ex.Message)
Finally
impContext.Undo()
If Page.IsPostBack Then
Dim spath As String
spath = "\\laptop02\temp\test.pdf"
'DownloadFile(spath, True)
Dim path1 As String = spath
Dim name As String = Path.GetFileName(path1)
Dim ext As String = Path.GetExtension(path1)
Dim type As String = ""
If Not (ext Is Nothing) Then
Select Case ext.ToLower
Case ".htm", ".html"
type = "text/HTML"
' break
Case ".txt"
type = "text/plain"
' break
Case ".doc", ".rtf"
type = "Application/msword"
' break
Case ".pdf"
type = "Application/pdf"
End Select
End If
'If forceDownload Then
Response.AppendHeader("content-disposition",
"attachment; filename = " & name)
'End If
If Not (type = "") Then
Response.ContentType = type
End If
Response.WriteFile(path1)
Response.End()
End If
End Try
End If
End Sub
thanks
balaImpersonation only allows access to local resources as the user who's using
your site. You want delegation which will allow off-host access as the user
who has authenticated in the browser. In essence it means you need to enable
this in AD for the machine that's running your webserver. Check out this
for more info:
http://pluralsite.com/wiki/default...elop.com/ballen

> Hi All,
> I am trying to download the file from network machine (under same
> domain). I am using below link page code to impersonate.
> http://www.netomatix.com/ImpersonateUser.aspx
> I can able to impersonate the user, when i try to download the file,
> its says "unknown user name and password". I given full permission to
> domain user. but the same time when i provied the user name and deails
> on webconfig file like below, its allowing me to download.
> <identity impersonate="true" userName="mydomain\bala"
> password="password" />
> I dont know where the problem is. Can anyone please give me idea to
> resolve this. I am trying to fix this problem past 3 days.
> below is the complete code i am using...
> i am getting error on response.writefile. This is the error message
> Logon failure: unknown user name or bad password. exception Details:
> System.IO.IOException: Logon failure: unknown user name or bad
> password.
> code:
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> Dim impContext As WindowsImpersonationContext = Nothing
> Try
> impContext =
> NetworkSecurity.ImpersonateUser("mydomain",
> "bala", "password", LogonType.LOGON32_LOGON_NETWORK,
> LogonProvider.LOGON32_PROVIDER_DEFAULT)
> Catch ex As ApplicationException
> impContext.Undo()
> Response.Write(ex.Message)
> End Try
> If Not (Nothing Is impContext) Then
> Try
> Catch ex As Exception
> Response.Write(ex.Message)
> Finally
> impContext.Undo()
> If Page.IsPostBack Then
> Dim spath As String
> spath = "\\laptop02\temp\test.pdf"
> 'DownloadFile(spath, True)
> Dim path1 As String = spath
> Dim name As String = Path.GetFileName(path1)
> Dim ext As String = Path.GetExtension(path1)
> Dim type As String = ""
> If Not (ext Is Nothing) Then
> Select Case ext.ToLower
> Case ".htm", ".html"
> type = "text/HTML"
> ' break
> Case ".txt"
> type = "text/plain"
> ' break
> Case ".doc", ".rtf"
> type = "Application/msword"
> ' break
> Case ".pdf"
> type = "Application/pdf"
> End Select
> End If
> 'If forceDownload Then
> Response.AppendHeader("content-disposition",
> "attachment; filename = " & name)
> 'End If
> If Not (type = "") Then
> Response.ContentType = type
> End If
> Response.WriteFile(path1)
> Response.End()
> End If
> End Try
> End If
> End Sub
> thanks
> bala
Hi Brock,
Thanks for the reply. The user name which i am using is under the same
DOMAIN.
Are you mentioning the same domain user or local user for that machine?
Thanks
bala
"Brock Allen" wrote:

> Impersonation only allows access to local resources as the user who's usin
g
> your site. You want delegation which will allow off-host access as the use
r
> who has authenticated in the browser. In essence it means you need to enab
le
> this in AD for the machine that's running your webserver. Check out this
> for more info:
> http://pluralsite.com/wiki/default...elop.com/ballen
>
>
>
>
> Thanks for the reply. The user name which i am using is under the same
> DOMAIN.
Ok, that shouldn't matter with delegation.

> Are you mentioning the same domain user or local user for that
> machine?
For delegation you'll have to be using kerb. The username doesn't matter,
the important thing is to configure the server to be trusted for delegation.
-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi Brock,
Using this below link code i can able to impersonate the user on my domain
user account. From my locl machine IIS i can able to download the other
machine file, like below path.
("AnotherNetworkMachine\temp\ss.pdf")
But when i place this code my server, the impersonate is doing succuss, but
its taking too much time to download and finally it says page cannot be
displayed error.
any idea.
bala
http://west-wind.com/weblog/posts/1572.aspx
"Brock Allen" wrote:

> Ok, that shouldn't matter with delegation.
>
> For delegation you'll have to be using kerb. The username doesn't matter,
> the important thing is to configure the server to be trusted for delegatio
n.
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
Hi Brock,
If i create a local account on webserver and same username and password for
network machine to local, In this point can i able to download the file?
thanks
bala
"Brock Allen" wrote:

> Ok, that shouldn't matter with delegation.
>
> For delegation you'll have to be using kerb. The username doesn't matter,
> the important thing is to configure the server to be trusted for delegatio
n.
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
sorry. when i run the application on same domain its download the file. but
from outside i am getting error. so that wont work.
bala
"Bala" wrote:
> Hi Brock,
> Using this below link code i can able to impersonate the user on my domain
> user account. From my locl machine IIS i can able to download the other
> machine file, like below path.
> ("AnotherNetworkMachine\temp\ss.pdf")
> But when i place this code my server, the impersonate is doing succuss, bu
t
> its taking too much time to download and finally it says page cannot be
> displayed error.
> any idea.
> bala
> http://west-wind.com/weblog/posts/1572.aspx
> "Brock Allen" wrote:
>
On Mon, 29 Aug 2005 13:45:32 -0700, "Bala" <Bala@.discussions.microsoft.com>
wrote:
Hi Brock,
If i create a local account on webserver and same username and password fo
r
network machine to local, In this point can i able to download the file?
As Brock was indicating, you need to delegate credentials which requires Ker
beros if your web
application is configured for Integrated Windows Security.
How to configure an ASP.NET application for a delegation scenario
http://support.microsoft.com/defaul...kb;en-us;810572
Paul
~~~~
Microsoft MVP (Visual Basic)

Permission Problem

I'm creating the administration module of the my application. I started by using my local machine as the web server. Currently, the application contains functionality that will: move a file to a server on the network, delete a file from the server on the network, and create a file on the server on the network. All of these functions worked beautifully on my local machine.
Now, I have moved my application from my local machine to the live web server for further testing. All of my functionality, at first, did not work. I would receive "Access denied" messages -- hence, a permission problem. (Keep in mind that there are two separate servers on the network that are used for IO operations in this app)
The network admin and I started at the first logical place -- folder permissions on both of the servers. To make a long story short, we set "Full Control" for "Everyone" on the one directory for server 1. This actually resolved the problem creating, moving, and deleting of files through my app. (Although, not the best solution, obviously) However, when setting the permissions for the other server, (and setting them identical to the first), the application still gets "Access denied" errors.
Can someone throw some suggestions my way, as to what permissions need to be set on these directories to work properly? I'm thrown off by the fact that it worked when my local machine acted as the web server, but not on the live web server. I also confirmed that the IIS settings for both my machine and live web server applications were identical. (Although my machine is running IIS 6, and the live server is 5 I believe)
Thanks!

"Although my machine is running IIS 6, and the live server is 5 I believe" - this probably has something to do with it
IIS 5 uses ASPNET to do work - IIS6 uses Network Authority
check outhttp://asp.net/faq/AspNetAndIIS6.aspx
On the servers - you can edit the Local Security Policy to log failed logons - and then you can see the account being used
Hope that Helps

I apologize...my local machine account is using IIS 5 and the web server is 6. I'll check out that article...


The server that is not allowing me to add/move/delete files does not have .NET installed. Stupid question, but is that what's causing the problem here? Do I need to install .NET and then add an ASPNET group to the directory?

Lots of possible issues here. First is how you're authenticating in the app. If you use anonymous access, the user has changed, and may be a network account if the server is a domain controller. Remember that the accounts on your workstation were likely local accounts and you would need to change the account for your app or duplicate that account on the network.

My guess is you're authenticating users since giving the Everyone group full control fixed the access. They may not need Full Control, and Modify might eb enough on the folders. You may even be authenticating without realizing it since IE will pass authentication credentials if the network is seen as being local or in the intranet security zone. Remove Windows Integrated authentication in your web site if you don't intend to authenticate.

Might try Filemon from Sysinternals.com to check access on specific files. This can help quite a bit on the server to server issues.

Jeff

Wednesday, March 21, 2012

Permissions Issues: Process.Start() & XCOPY

I am using a C# / ASP.NET application to fire an XCOPY job from the
webserver to a UNC share. This setup works fine when copying to a
local machine but refuses to work on the remote copy. The process
executes correctly, but XCOPY returns "invalid drive specification",
which I'm guessing actually means that the current user context
(ASP.NET application) can't access the share (e.g.
\\someserver\c$\mydir\)
Anyway, here's where I'm at with permissions:
* Changed the ASPNET account to run as System in machine.config
(reboot)
* added
<identity impersonate="true" userName="MY_DOMAIN\\administrator"
password="xxxx" /> to web.config
* Interesting note: when I display the current uiser the ASP.NET app
is running under, I get MACHINENAME/Administrator, not
DOMAIN/Administrator. This seems wrong?
Other examples on the web seem to indicate that this is an issue with
System.Diagnostics.Process, in that it incorrectly uses the user
token, blah blah, (i.e. a bug in .NET). System.Diagnostics.Process
doesn't have the capability to supply user credentials to the process
it runs (a somewhat ridiculous omission)
Any ideas here? TIA.
- Mattwith NT when you start a process, it inherits the security context of the
starting process (aspnet.exe) not thread (also ignore impersonation). you
can have asp.net run as a domain account rather than system. to skip this
look at CreateProcessAsUser, which allows starting a process as a different
user.
-- bruce (sqlwork.com)
"Matthew Lee" <matt@.vistaser.com> wrote in message
news:b2e48659.0406071552.26228815@.posting.google.com...
> I am using a C# / ASP.NET application to fire an XCOPY job from the
> webserver to a UNC share. This setup works fine when copying to a
> local machine but refuses to work on the remote copy. The process
> executes correctly, but XCOPY returns "invalid drive specification",
> which I'm guessing actually means that the current user context
> (ASP.NET application) can't access the share (e.g.
> \\someserver\c$\mydir\)
> Anyway, here's where I'm at with permissions:
> * Changed the ASPNET account to run as System in machine.config
> (reboot)
> * added
> <identity impersonate="true" userName="MY_DOMAIN\\administrator"
> password="xxxx" /> to web.config
> * Interesting note: when I display the current uiser the ASP.NET app
> is running under, I get MACHINENAME/Administrator, not
> DOMAIN/Administrator. This seems wrong?
> Other examples on the web seem to indicate that this is an issue with
> System.Diagnostics.Process, in that it incorrectly uses the user
> token, blah blah, (i.e. a bug in .NET). System.Diagnostics.Process
> doesn't have the capability to supply user credentials to the process
> it runs (a somewhat ridiculous omission)
> Any ideas here? TIA.
> - Matt
"bruce barker" <nospam_brubar@.safeco.com> wrote in message news:<#Mgod2OTEHA.332@.TK2MSFTNGP
11.phx.gbl>...
> with NT when you start a process, it inherits the security context of the
> starting process (aspnet.exe) not thread (also ignore impersonation). you
> can have asp.net run as a domain account rather than system. to skip this
> look at CreateProcessAsUser, which allows starting a process as a differen
t
> user.
I actually tried some C# interop classes I found on the ASP.NET site,
they use LogonUser from the W32 API, but it still does't work.
Just to clarify:
* if ASP.NET is configured to run as SYSTEM, then why is there an
issue? Wouldn't the "security of the starting process" now be the
System account?
* therefore it would be correct that impersonation as I understand it
only applies to the ASP.NET application itself and not processes
started by the ASP.NET application?
If the above are true, then how is it possible *AT ALL* to launch a
process as a user without resorting to API calls?
I've spent 2 days on this and it's obviously a common problem.
Thanks for your help.

Permissions Issues: Process.Start() & XCOPY

I am using a C# / ASP.NET application to fire an XCOPY job from the
webserver to a UNC share. This setup works fine when copying to a
local machine but refuses to work on the remote copy. The process
executes correctly, but XCOPY returns "invalid drive specification",
which I'm guessing actually means that the current user context
(ASP.NET application) can't access the share (e.g.
\\someserver\c$\mydir\)

Anyway, here's where I'm at with permissions:

* Changed the ASPNET account to run as System in machine.config
(reboot)
* added
<identity impersonate="true" userName="MY_DOMAIN\\administrator"
password="xxxx" /> to web.config

* Interesting note: when I display the current uiser the ASP.NET app
is running under, I get MACHINENAME/Administrator, not
DOMAIN/Administrator. This seems wrong?

Other examples on the web seem to indicate that this is an issue with
System.Diagnostics.Process, in that it incorrectly uses the user
token, blah blah, (i.e. a bug in .NET). System.Diagnostics.Process
doesn't have the capability to supply user credentials to the process
it runs (a somewhat ridiculous omission)

Any ideas here? TIA.

- Mattwith NT when you start a process, it inherits the security context of the
starting process (aspnet.exe) not thread (also ignore impersonation). you
can have asp.net run as a domain account rather than system. to skip this
look at CreateProcessAsUser, which allows starting a process as a different
user.

-- bruce (sqlwork.com)

"Matthew Lee" <matt@.vistaseeker.com> wrote in message
news:b2e48659.0406071552.26228815@.posting.google.c om...
> I am using a C# / ASP.NET application to fire an XCOPY job from the
> webserver to a UNC share. This setup works fine when copying to a
> local machine but refuses to work on the remote copy. The process
> executes correctly, but XCOPY returns "invalid drive specification",
> which I'm guessing actually means that the current user context
> (ASP.NET application) can't access the share (e.g.
> \\someserver\c$\mydir\)
> Anyway, here's where I'm at with permissions:
> * Changed the ASPNET account to run as System in machine.config
> (reboot)
> * added
> <identity impersonate="true" userName="MY_DOMAIN\\administrator"
> password="xxxx" /> to web.config
> * Interesting note: when I display the current uiser the ASP.NET app
> is running under, I get MACHINENAME/Administrator, not
> DOMAIN/Administrator. This seems wrong?
> Other examples on the web seem to indicate that this is an issue with
> System.Diagnostics.Process, in that it incorrectly uses the user
> token, blah blah, (i.e. a bug in .NET). System.Diagnostics.Process
> doesn't have the capability to supply user credentials to the process
> it runs (a somewhat ridiculous omission)
> Any ideas here? TIA.
> - Matt
"bruce barker" <nospam_brubar@.safeco.com> wrote in message news:<#Mgod2OTEHA.332@.TK2MSFTNGP11.phx.gbl>...
> with NT when you start a process, it inherits the security context of the
> starting process (aspnet.exe) not thread (also ignore impersonation). you
> can have asp.net run as a domain account rather than system. to skip this
> look at CreateProcessAsUser, which allows starting a process as a different
> user.

I actually tried some C# interop classes I found on the ASP.NET site,
they use LogonUser from the W32 API, but it still does't work.

Just to clarify:
* if ASP.NET is configured to run as SYSTEM, then why is there an
issue? Wouldn't the "security of the starting process" now be the
System account?

* therefore it would be correct that impersonation as I understand it
only applies to the ASP.NET application itself and not processes
started by the ASP.NET application?

If the above are true, then how is it possible *AT ALL* to launch a
process as a user without resorting to API calls?

I've spent 2 days on this and it's obviously a common problem.

Thanks for your help.

Permissions to call LogonUser

I have been troubleshooting writing a log file to a fileshare on
another machine... and I can't seem to find my way past the "Double
Hop" issue. I seem have narrowed it down to a failure of the
LogonUser call. On Windows 2000 with IIS 5 and ASP.NET 2.0 the
LogonUser call returns 0. From a Windows Forms client I can get the
LogonUser call to work fine (returns 1).
So what allows me to call LogonUser? Is there something I need to do
in the web.config or machine.config? I already tried the change where
you give ASPNET account the right to "Act as part of the OS".
Any other ideas? Articles? I'd like to get this working under IIS 5 if
possible.
Kelly Greer
kellygreer1@dotnet.itags.org.nospam.com
change nospam to yahooyou may need to revert to the process token, to allow impersonation.
RevertToSelf();
before calling logon
-- bruce (sqlwork.com)
"kellygreer1" wrote:

> I have been troubleshooting writing a log file to a fileshare on
> another machine... and I can't seem to find my way past the "Double
> Hop" issue. I seem have narrowed it down to a failure of the
> LogonUser call. On Windows 2000 with IIS 5 and ASP.NET 2.0 the
> LogonUser call returns 0. From a Windows Forms client I can get the
> LogonUser call to work fine (returns 1).
> So what allows me to call LogonUser? Is there something I need to do
> in the web.config or machine.config? I already tried the change where
> you give ASPNET account the right to "Act as part of the OS".
> Any other ideas? Articles? I'd like to get this working under IIS 5 if
> possible.
> Kelly Greer
> kellygreer1@.nospam.com
> change nospam to yahoo
>

Permissions to call LogonUser

I have been troubleshooting writing a log file to a fileshare on
another machine... and I can't seem to find my way past the "Double
Hop" issue. I seem have narrowed it down to a failure of the
LogonUser call. On Windows 2000 with IIS 5 and ASP.NET 2.0 the
LogonUser call returns 0. From a Windows Forms client I can get the
LogonUser call to work fine (returns 1).

So what allows me to call LogonUser? Is there something I need to do
in the web.config or machine.config? I already tried the change where
you give ASPNET account the right to "Act as part of the OS".

Any other ideas? Articles? I'd like to get this working under IIS 5 if
possible.

Kelly Greer
kellygreer1@dotnet.itags.org.nospam.com
change nospam to yahooyou may need to revert to the process token, to allow impersonation.

RevertToSelf();

before calling logon

-- bruce (sqlwork.com)

"kellygreer1" wrote:

Quote:

Originally Posted by

I have been troubleshooting writing a log file to a fileshare on
another machine... and I can't seem to find my way past the "Double
Hop" issue. I seem have narrowed it down to a failure of the
LogonUser call. On Windows 2000 with IIS 5 and ASP.NET 2.0 the
LogonUser call returns 0. From a Windows Forms client I can get the
LogonUser call to work fine (returns 1).
>
So what allows me to call LogonUser? Is there something I need to do
in the web.config or machine.config? I already tried the change where
you give ASPNET account the right to "Act as part of the OS".
>
Any other ideas? Articles? I'd like to get this working under IIS 5 if
possible.
>
Kelly Greer
kellygreer1@.nospam.com
change nospam to yahoo
>