J
j_stus
Here is my problem.
I reported this before, I got some tips and resolved some of the
problems, but still not the way it would satisfy me and my needs...
I try to execute this code.
Dim myFolder As String = Server.MapPath("..\..\..\sDirectory\")
Dim FileName As String
For Each FileName In Directory.GetFiles(myFolder , "*.doc")
Response.Write(FileName)
Exit For
Next
sDirectory is a virtual directory that points to some location on
another computer which is w2000 server.
My website is on another computer which is w2003 server.
On my domain I created new user. This user has rights to sDirectory.
If I modify my web.config to <identity impersonate="true"
userName="DOMAIN\user" password="somepassword"></identity>
it will list all my files.
I cannot do it though, because I am not writing new website. I am just
modifying existing one, and if I would modify webconfig, it would brake
other parts of the code.
I tried to change identity "on fly"
Dim tokenHandle As New IntPtr(0)
Dim dupeTokenHandle As New IntPtr(0)
tokenHandle = IntPtr.Zero
LogonUser(userName, domainName, password, 3, 0, tokenHandle)
Dim newId As New WindowsIdentity(tokenHandle)
Dim impersonatedUser As WindowsImpersonationContext =
newId.Impersonate()
Even though user name, password and domain are the same as in identity
impersonate, it would not let me list files...
now I am stuck, not sure what I can try next....
My ASP version is v1.1.4322
I reported this before, I got some tips and resolved some of the
problems, but still not the way it would satisfy me and my needs...
I try to execute this code.
Dim myFolder As String = Server.MapPath("..\..\..\sDirectory\")
Dim FileName As String
For Each FileName In Directory.GetFiles(myFolder , "*.doc")
Response.Write(FileName)
Exit For
Next
sDirectory is a virtual directory that points to some location on
another computer which is w2000 server.
My website is on another computer which is w2003 server.
On my domain I created new user. This user has rights to sDirectory.
If I modify my web.config to <identity impersonate="true"
userName="DOMAIN\user" password="somepassword"></identity>
it will list all my files.
I cannot do it though, because I am not writing new website. I am just
modifying existing one, and if I would modify webconfig, it would brake
other parts of the code.
I tried to change identity "on fly"
Dim tokenHandle As New IntPtr(0)
Dim dupeTokenHandle As New IntPtr(0)
tokenHandle = IntPtr.Zero
LogonUser(userName, domainName, password, 3, 0, tokenHandle)
Dim newId As New WindowsIdentity(tokenHandle)
Dim impersonatedUser As WindowsImpersonationContext =
newId.Impersonate()
Even though user name, password and domain are the same as in identity
impersonate, it would not let me list files...
now I am stuck, not sure what I can try next....
My ASP version is v1.1.4322