How to logon to network server via code

  • Thread starter Thread starter Dean Slindee
  • Start date Start date
D

Dean Slindee

I am writing a windows service that needs to logon to a server to import a
file residing on that server. The server is on the local network, but in
the dmz. Not sure is the latter makes any difference, but is there a way to
programmatically logon to that server with proper credentials with VB code?
What's involved? Example?

Thanks in advance,
Dean S
 
Normally you would use the LogonUser function, but knowing that it fails on
Windows 2000 Pro & Server because ACT AS PART AS THE OPERATING SYSTEM is
needed for it to succeed

However, on XP Home/Pro LogonUser is successful, but not sure on Windows
2003.

Here's a little info on using/declaring this function:

http://www.pinvoke.net/default.aspx/advapi32/LogonUser.html
http://aspalliance.com/39

That will give you a start

For more infor search MSDN for the LogonUser API in the 2003 SP1 SDK

I hope this helps,

Newbie Coder
 
Back
Top