The WSLoginControl
WinFormsEx.dll contains the definition of WSLoginControl
, shown in Example B-7.
Example B-7. The WSLoginControl class
public partial class WSLoginControl : LoginControl { protected override IUserManager GetUserManager() { return new UserManager(); } }
WSLoginControl
derives from LoginControl
, and in its overriding of GetUserManager()
it returns UserManager
, a client-side web service proxy class used to invoke the UserManager
web service. WSLoginControl
can use any web service that manages user credentials, as long as it supports the IUserManager
interface (hence its name). To generate the proxy class, add a web reference to the UserManager
web service. Add to the machine-generated UserManager
web service proxy class derivation from IUserManager
. Since the proxy class is a partial class and is machine-generated, add that code, preferably in a separate file:
partial class UserManager : IUserManager {}
WinFormsEx.dll already contains the definition of the UserManager
web service proxy class. The code in the proxy class looks up the web service address from the application configuration file. Under the appSettings
section, add to the application configuration file a key called UserManager
, whose value is the web service address:
<?xml version="1.0"?> <configuration> <appSettings> <add key="UserManager" value="http://localhost/SecurityServices/UserManager.asmx"/> </appSettings> </configuration>
Figure B-5 shows WSLoginControl
and CustomPrincipal
, and their interaction ...
Get Programming .NET Components, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.