PassportIdentity.GetDomainAttribute
PassportIdentity.GetDomainAttribute
Provides information for a particular Microsoft® .NET Passport domain by querying the Passport Manager for the requested domain attribute.
Syntax
public string GetDomainAttribute( string strAttribute, int iLCID, string strDomain)
Parameters
strAttribute
The name of the attribute value to retrieve.iLCID
The language in which .NET Passport network pages should be displayed to the user.The iLCID is an integer representation of a standard locale ID (LCID). For example, U.S. English (EN/US) is 1033. For a table of LCIDs, see Localization and .NET Passport Services.
strDomain
The domain authority name to query for an attribute.
Return values
A string representing the requested attribute, typically a URL. If the requested attribute does not exist, as determined by reading the Component Configuration Document (CCD), an empty string will be returned. For example, the returned value for a requested attribute of an EDITPROFILE may be similar to "https://current-register.passporttest.com/editprof.srf?lc=1033 ".
Example
The following example uses GetDomainFromMemberName to get a user's domain authority and GetDomainAttribute to make links to the Edit Profile, Change Password, Customer Service, Change Secret Question, Member Profile, and .NET Passport Home pages.
<%@ Page Language="C#"%> <%@ Import Namespace = "System.Web.Security" %> <HTML> <HEAD><TITLE>Mysample - Exercise - CS</TITLE></HEAD> <Script language="C#" runat="server"> string sServer; PassportIdentity oMgr; string sthisURL, sruURL; string strDomain; int iLCID; protected void Page_Load(Object src, EventArgs e) { sServer = Request.ServerVariables["SERVER_NAME"]; oMgr = (PassportIdentity)User.Identity; sthisURL = "https://" + sServer + Request.ServerVariables["SCRIPT_NAME"]; sruURL = "https://" + sServer + "/BriefCS/default.aspx"; } </Script> <% if (oMgr.IsAuthenticated) { //Set the sign-out URL - return to the default.asp sruURL = sruURL; } else { //Set the sign-in URL - stay on this page sruURL = sthisURL; } //LogoTag2 allows the user to sign in or out. Response.Write ("<DIV STYLE = 'position:absolute; right:50px'>" + oMgr.LogoTag2(sruURL,3600,true,null,1033,false,null,-1,false) + "</DIV>"); if (oMgr.GetIsAuthenticated(3600,false,false)) { Response.Write ("<br>You are authenticated."); //strDomain is the domain name to query for an attribute. strDomain = oMgr.GetDomainFromMemberName(oMgr.GetProfileObject("memberName").ToString()); Response.Write ("<br>strDomain = " + strDomain); //Lang_Preference is your language (US=1033). iLCID = Convert.ToInt32 (oMgr.GetProfileObject("lang_preference")); Response.Write("<br>Lang_Preference (iLCID) = " + iLCID); %> <!--Set hyperlinks to the GetDomainAttribute pages --> <a href=<%Response.Write (oMgr.GetDomainAttribute("EDITPROFILE",iLCID,strDomain));%>><br>Edit profile</a> <a href=<%Response.Write (oMgr.GetDomainAttribute("CHANGEPASSWORD",iLCID,strDomain));%>><br>Change Password</a> <a href=<%Response.Write (oMgr.GetDomainAttribute("CUSTOMERSERVICE",iLCID,strDomain));%>><br>Customer Service</a> <a href=<%Response.Write (oMgr.GetDomainAttribute("CHANGESECRETQ",iLCID,strDomain));%>><br>Change Secret Question</a> <a href=<%Response.Write (oMgr.GetDomainAttribute("MPP",iLCID,strDomain));%>><br>Member Profile Pages</a> <a href=<%Response.Write (oMgr.GetDomainAttribute("PASSPORTHOME",iLCID,strDomain));%>><br>Passport Service Web Page</a> <% } else { Response.Write ("<br>You have not been authenticated within the last hour. Please sign in or exit."); } // End If GetIsAuthenticated %> </HTML>
Remarks
This method returns information about a given user's domain, such as registration URL. This method returns information defined in the Partner.xml file.
The returned value from this method allows the user to go to specific .NET Passport domain pages to perform specific tasks, such as to edit the user's profile, change the user's password, and to modify the user's secret question. Placing the returned value as a URL into Web browser will link you to the selected attribute.
See Also
Passport PassportIdentity Object | Linking to .NET Passport Services