Share via


PassportIdentity.GetFromNetworkServer

PassportIdentity.GetFromNetworkServer

Determines whether a connection is coming back from a Microsoft .NET Passport server (Login, Update, or Registration) and whether the .NET Passport data contained on the query string is valid.

Syntax

public bool GetFromNetworkServer [get]

Property value

true if a connection is coming back from the .NET Passport server and if the .NET Passport data contained on the query string is valid; otherwise, false

Example

The following C# example displays the value of GetFromNetworkServer for the authenticated, signed-in user.

<%@ Page Language="C#"%>
<%@ Import Namespace = "System.Web.Security" %>
<HTML>
<HEAD><TITLE>Mysample - Exercise - CS</TITLE></HEAD>
<Script language="C#" runat="server">
 string sServer;
 string sthisURL;
 protected void Page_Load(Object src, EventArgs e) {
  sServer = Request.ServerVariables["SERVER_NAME"];
  sthisURL = "https://" + sServer + Request.ServerVariables["SCRIPT_NAME"];
 }
</Script>
<%
//Instantiate a PassportIdentity object.
PassportIdentity oMgr = (PassportIdentity)User.Identity;

//LogoTag2 allows the user to sign in or out.
Response.Write ("<DIV STYLE = 'position:absolute; right:50px'>" + oMgr.LogoTag2(sthisURL,3600,true,null,1033,false,null,-1,false) + "</DIV>");

//Get and print the GetFromNetworkServer
if (oMgr.GetFromNetworkServer) {
 //You just came from a sign in
 Response.Write ("<br>You just came from the .NET Passport server.");
}
else {
 Response.Write ("<br>You did not just come from the .NET Passport server.");
}
Response.Write (" GetFromNetworkServer is " + oMgr.GetFromNetworkServer + ".");
%>

If you are directed to this page directly from the .NET Passport server, you will receive the following output:

You just came from the .NET Passport server. GetFromNetworkServer is true.

If you are directed to this page from somewhere other than the .NET Passport server, you will receive the following output:

You did not just come from the .NET Passport server. GetFromNetworkServer is false.

Remarks

A read-only property. true indicates that the user has just returned from a .NET Passport network server. false indicates that the user has come from some page other than the .NET Passport network server. On a Microsoft Windows XP system, when the value is true, refreshing the page will show this value to be false, as the page is no longer directly from a network server. On a Microsoft Windows 2000 system, the query string contains a t and p. Redirecting the page without the t and p parameters will change the value to false.

See Also

Passport PassportIdentity Object