Sample - Bypass Login

Version 5

    Versions: 9.3.1 - current

    Product Availability: ArcFM Engine

     

    This developer sample allows the user the open ArcFM Viewer for ArcGIS Engine without a login screen. The sample points to a specific connection in DatabaseConnections.xml. The connection must use Operating System Authentication to ensure the user is not prompted to log in.

     

    How to Implement:

    1. Open the solution (BypassEngineLogin.sln).
    2. Modify the code sample to use your connection information. Edit DatabaseConnections.xml to point to the server to which you want to connect using Operating System Authentication (OSA). Make note of the Connection Name value. You will need to enter this name in BypassXmlLoginObject.cs.


          <Connection Name="Dakota SQL Express">

                <GDBConnection>

                      <Server>Dakota_sqlexpress</Server>

                      <Instance>sde:sqlserver:Dakota\sqlexpress</Instance>

                      <Database>arcfmwg</Database>

                      <Authentication_Mode>OSA</Authentication_Mode>

                </GDBConnection>

          </Connection>



                 <Connection Name="Dakota SQL Express">

     

    1. Open BypassXmlLoginObject.cs (view code) and look for the following:

     

               try

                {

                    if (MinerLogin.Initialize(_connectionsXmlFile) && MinerLogin.SetConnection("Dakota SQL Express"))

                    {

                        IPropertySet propSet = MinerLogin.ConnectionProperties();

                        _defaultLoginObject.SetConnectionProperties(propSet);

                        _defaultLoginObject.ShowDialog = false;

                        _loginChanged = _defaultLoginObject.Login(vbInitialLogin);

                        if (_loginChanged) _defaultLoginObject.ValidateSystemTables(_defaultLoginObject.LoginWorkspace, "ArcFM Viewer for ArcGIS Engine");

                    }

                }

     

    1. Note that MinerLogin.SetConnection is pointed to "Dakota SQL Express". Change this value to the name of your connection as it is set in DatabaseConnections.xml. The login in this connection must use Operating System Authentication.
    2. Build the solution.
    3. Create a string value called Login at one of the following locations in the Registry:   
      • 32-bit: HKEY_LOCAL_MACHINE\SOFTWARE\Miner and Miner\ArcFM Viewer for ArcGIS Engine
      • 64-bit: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Miner and Miner\ArcFM Viewer for ArcGIS Engine
    4. Right-click the Login key and create a String Value called LoginObject.
    5. Right-click the LoginObject String Value and select Modify.
    6. Enter the progID of the .cls you wish to use in the Value Data field. The progID is Namespace.Class Name. For example: BypassEngineLogin.BypassXmlLoginObject.
    7. Any time you wish to use a different login object, modify this progID to correspond with the login object you wish to use.


    Requires:

    All of the files shown below are required for the project to compile successfully.

    FileDescription
    ArcFMEngineLogin.slnC# solution containing the sample code to bypass a login screen for ArcFM Viewer for ArcGIS Engine
    ArcFMEngineLogin.csprojC# project containing the code to bypass a custom login object
    BypassXmlLoginObject.csClass module that implements IMMLoginObject, IMMChangeDefaultVersion, and IMMAdoConnection