How to show Windows Credentials Prompt

P

pascal

Simple question, already searched but really nothing found.

When I try to access a network resource - of a server I not yet have
authenticated against - I get a Windows Credentials Prompt.

I'm developing an .net application that needs to access a network
share. Is there a .net or WinAPI call I can make that shows this
Windows Credentials Prompt and gives me back a token so that I can
Impersonate that User to access the network resource? Without this i
get security exceptions and can not access files.

Impersonation by using a Token through calling LogonUser API (with
user password given) works. But i would prefer showing the Windows
Prompt instead of doing a own user/pass prompt.

And, is there an API to check if a token exists to access a server?
(checking if it is necessary to show the prompt.)

thanks a lot!
 
A

Alun Jones

"pascal" <pascal@hausers.info> wrote in message
news:8d8bb384-0b56-4d1e-8a7a-536ba20a5059@x35g2000hsb.googlegroups.com...
> Simple question, already searched but really nothing found.
>
> When I try to access a network resource - of a server I not yet have
> authenticated against - I get a Windows Credentials Prompt.
>
> I'm developing an .net application that needs to access a network
> share. Is there a .net or WinAPI call I can make that shows this
> Windows Credentials Prompt and gives me back a token so that I can
> Impersonate that User to access the network resource? Without this i
> get security exceptions and can not access files.
>
> Impersonation by using a Token through calling LogonUser API (with
> user password given) works. But i would prefer showing the Windows
> Prompt instead of doing a own user/pass prompt.
>
> And, is there an API to check if a token exists to access a server?
> (checking if it is necessary to show the prompt.)


CredUIPromptForWindowsCredentials should do the trick of getting you a
username and password back - I don't see a function that just returns a
token.

Alun.
~~~~
--
Texas Imperial Software | Web: http://www.wftpd.com/
23921 57th Ave SE | Blog: http://msmvps.com/alunj/
Woodinville WA 98072-8661 | WFTPD, WFTPD Pro are Windows FTP servers.
Fax/Voice +1(425)807-1787 | Try our NEW client software, WFTPD Explorer.
 
Back
Top Bottom