Home All Groups Group Topic Archive Search About

RE: Impersonate FileOpenDialog/ FolderBrowserDialog

Author
22 May 2009 7:27 PM
crimdog02
I am experiencing the exact same problem.

Show quoteHide quote
"jdke***@gmail.com" wrote:

> Hi
>
> When attempting to impersonate code, it appears that any dialogs that
> open run as the logged in user, not the user that I'm trying to
> impersonate.  Other code, such as file.exists runs as the impersonated
> user.
>
> for example:
>
>         Using imp As New Impersonator(tb_UserName.Text, "domain",
> tb_Password.Text)
>             Dim f As New FolderBrowserDialog()
>             Dim d As DialogResult = f.ShowDialog()
>         End Using
>
> The folder browser allows me to navigate to folders my impersonated
> user should not have access to, but my logged in user does have access
> to.
>
> Any help would be appreciated.
>

Author
22 May 2009 7:46 PM
crimdog02
Actually, I misspoke.  Mine works correctly for OpenFileDialog (once I passed
in the correct parameter to LogonUser).  But it doesnt work for
FolderBrowserDialog.

For the OpenFileDialog, make sure that your LogonUser call looks something
like this:
If LogonUser(userName, userDomain, userPassword, 2, 0, token) Then

The code I originally had used 3 instead of 2, and in that case it worked on
local drives but not on network drives.

Show quoteHide quote
"crimdog02" wrote:

> I am experiencing the exact same problem.
>
> "jdke***@gmail.com" wrote:
>
> > Hi
> >
> > When attempting to impersonate code, it appears that any dialogs that
> > open run as the logged in user, not the user that I'm trying to
> > impersonate.  Other code, such as file.exists runs as the impersonated
> > user.
> >
> > for example:
> >
> >         Using imp As New Impersonator(tb_UserName.Text, "domain",
> > tb_Password.Text)
> >             Dim f As New FolderBrowserDialog()
> >             Dim d As DialogResult = f.ShowDialog()
> >         End Using
> >
> > The folder browser allows me to navigate to folders my impersonated
> > user should not have access to, but my logged in user does have access
> > to.
> >
> > Any help would be appreciated.
> >
Author
21 Jun 2009 11:38 AM
Meron LAVIE
I too am enocuntering this problem only FolderBrowseDialog, but not with
OpenFileDialog.

Has anyone been able to browse the network with impersonation using
FolderbrowseDialog?

Lavie

Show quoteHide quote
"crimdog02" <crimdo***@discussions.microsoft.com> wrote in message
news:F9BD47CD-EE0C-49D0-A709-09DBDE09E42E@microsoft.com...
> Actually, I misspoke.  Mine works correctly for OpenFileDialog (once I
> passed
> in the correct parameter to LogonUser).  But it doesnt work for
> FolderBrowserDialog.
>
> For the OpenFileDialog, make sure that your LogonUser call looks something
> like this:
> If LogonUser(userName, userDomain, userPassword, 2, 0, token) Then
>
> The code I originally had used 3 instead of 2, and in that case it worked
> on
> local drives but not on network drives.
>
> "crimdog02" wrote:
>
>> I am experiencing the exact same problem.
>>
>> "jdke***@gmail.com" wrote:
>>
>> > Hi
>> >
>> > When attempting to impersonate code, it appears that any dialogs that
>> > open run as the logged in user, not the user that I'm trying to
>> > impersonate.  Other code, such as file.exists runs as the impersonated
>> > user.
>> >
>> > for example:
>> >
>> >         Using imp As New Impersonator(tb_UserName.Text, "domain",
>> > tb_Password.Text)
>> >             Dim f As New FolderBrowserDialog()
>> >             Dim d As DialogResult = f.ShowDialog()
>> >         End Using
>> >
>> > The folder browser allows me to navigate to folders my impersonated
>> > user should not have access to, but my logged in user does have access
>> > to.
>> >
>> > Any help would be appreciated.
>> >
Author
22 Jun 2009 7:24 AM
Meron LAVIE
BTW - I've checked this - and it works fine on W2K3 Server - it only seems
to be a problem in Vista.

Show quoteHide quote
"Meron LAVIE" <la***@net2vision.net.il> wrote in message
news:%23Qy0YTm8JHA.1492@TK2MSFTNGP03.phx.gbl...
>I too am enocuntering this problem only FolderBrowseDialog, but not with
>OpenFileDialog.
>
> Has anyone been able to browse the network with impersonation using
> FolderbrowseDialog?
>
> Lavie
>
> "crimdog02" <crimdo***@discussions.microsoft.com> wrote in message
> news:F9BD47CD-EE0C-49D0-A709-09DBDE09E42E@microsoft.com...
>> Actually, I misspoke.  Mine works correctly for OpenFileDialog (once I
>> passed
>> in the correct parameter to LogonUser).  But it doesnt work for
>> FolderBrowserDialog.
>>
>> For the OpenFileDialog, make sure that your LogonUser call looks
>> something
>> like this:
>> If LogonUser(userName, userDomain, userPassword, 2, 0, token) Then
>>
>> The code I originally had used 3 instead of 2, and in that case it worked
>> on
>> local drives but not on network drives.
>>
>> "crimdog02" wrote:
>>
>>> I am experiencing the exact same problem.
>>>
>>> "jdke***@gmail.com" wrote:
>>>
>>> > Hi
>>> >
>>> > When attempting to impersonate code, it appears that any dialogs that
>>> > open run as the logged in user, not the user that I'm trying to
>>> > impersonate.  Other code, such as file.exists runs as the impersonated
>>> > user.
>>> >
>>> > for example:
>>> >
>>> >         Using imp As New Impersonator(tb_UserName.Text, "domain",
>>> > tb_Password.Text)
>>> >             Dim f As New FolderBrowserDialog()
>>> >             Dim d As DialogResult = f.ShowDialog()
>>> >         End Using
>>> >
>>> > The folder browser allows me to navigate to folders my impersonated
>>> > user should not have access to, but my logged in user does have access
>>> > to.
>>> >
>>> > Any help would be appreciated.
>>> >
>