共用方式為


PassportIdentity.GetOption

PassportIdentity.GetOption

Gets a specific Microsoft® .NET Passport sign-in option.

Syntax

public object GetOption( string strOpt )

Parameters

  • strOpt
    The sign-in option to query.

Return values

Returns the value of the specified option.

Example

The following C# example displays the value of the GetOption with the iMode attribute. Because the .NET Passport has just been created, this method returns a null.

<%@ 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>GetOption('iMode') = " + oMgr.GetOption("iMode"));
}
else {
 Response.Write ("You have not been authenticated within the last hour. Please exit.");
} // End if GetIsAuthenticated
%>
</HTML>

Remarks

Attempting to exercise the GetOption method for a nonexistent attribute (strOpt) may cause a run-time error.

The following table lists the strOpt available for the GetOption method.

strOption Description
iMode Mobile devices. GetOption("iMode") is null when the PassportIdentity object is created and initialized. The SetOption method must be implemented before retrieving this value. The primary purpose of the GetOption property for iMode is for the participating site to inform the .NET Passport service that the user has an iMode browser. In this case, Microsoft .NET Passport returns truncated authentication information.

See Also

Passport PassportIdentity Object | Implementing Mobile .NET Passport | PassportIdentity.SetOption