Common_SecurityPassThrough_VBNet\SecurityPassThrough_WinInternet_VBNet\Default.aspx.vb
' Copyright 2010 ESRI ' ' All rights reserved under the copyright laws of the United States ' and applicable international laws, treaties, and conventions. ' ' You may freely redistribute and use this sample code, with or ' without modification, provided you include the original copyright ' notice and use restrictions. ' ' See the use restrictions. ' Imports Microsoft.VisualBasic Imports System Imports System.Collections.Generic Imports System.Linq Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls Partial Public Class _Default Inherits System.Web.UI.Page Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) ' At startup, we check whether all resources can be initialized with the ' current user's identity. We've already done impersonation in the ' Global.asax, so the page is running with the browser user's identity. ' Note this code is optional, as it just displays a message if a service ' can't be connected to. If (Not Page.IsPostBack) Then Dim resourceFailed As Boolean = False ' See whether we can initialize each resource. Since we're ' impersonating the user, initialization failure can mean an invalid ' user for the service. For Each mapResourceItem As ESRI.ArcGIS.ADF.Web.UI.WebControls.MapResourceItem In MapResourceManager1.ResourceItems ' If not already initialized, attempt to initialize the resource If mapResourceItem.Resource Is Nothing OrElse (Not mapResourceItem.Resource.Initialized) Then mapResourceItem.InitializeResource() End If ' Set failure flag if this resource fails to initialize If mapResourceItem.FailedToInitialize Then resourceFailed = True End If Next mapResourceItem ' If one or more resources couldn't be connected to, display the ' label containing the notification message. Note that failure could ' also be caused by other issues, such as the map server or service ' being unavailable. ResourceFailureLabel.Visible = resourceFailed End If End Sub End Class