Share via


PassportIdentity.GetCurrentConfig

PassportIdentity.GetCurrentConfig

Returns the contents of a registry key under the registry hive HKLM\SW\Microsoft\Passport.

Syntax

public object GetCurrentConfig( string strAttribute )

Parameters

  • strAttribute
    The key name (attribute) of the configuration value to be retrieved. The parameter specifies the name of the key as seen in the registry.

Return values

An object containing the value of the requested Microsoft .NET Passport configuration information.

Example

The following C# example displays the value of the three GetCurrentConfig attributes of the configuration: the Site ID, the installation directory, and the language ID.

<%@ Page Language="C#"%>
<HTML>
<HEAD><TITLE>Mysample - Exercise - CS</TITLE></HEAD>
<Script language="C#" runat="server">
 PassportIdentity oMgr;

 protected void Page_Load(Object src, EventArgs e) {
   oMgr = (PassportIdentity)User.Identity;
 }
</Script>
<%
if (oMgr.GetIsAuthenticated(3600,false,false)) {
 //You are authenticated, get the requested information.
 Response.Write("<br>Server SiteID = " + oMgr.GetCurrentConfig("SiteID"));
 Response.Write("<br>Server InstallDir = " + oMgr.GetCurrentConfig("InstallDir"));
 Response.Write("<br>Server LanguageID = " + oMgr.GetCurrentConfig("LanguageID"));
}
else {
 Response.Write("You have not been authenticated within the last hour. Please sign in or exit.");
} // End if GetIsAuthenticated
%>
</HTML>

Remarks

Use this method to determine a particular request's matching Site ID on the basis of host-name determination. Some of the returned values are available from the Passport Manager Administration utility at the server's site.

An attempt to read an attribute will first result in a check for the requested attribute name in the .NET Passport registry that is kept on the server. If found, the named attribute is fetched and a value is returned. Requesting an strAttribute that does not exist will give a run-time error.

See Also

Passport PassportIdentity Object | Passport Manager Administration Utility