/// <summary> /// initialization /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Init( object sender, EventArgs e) { try { // retrieve the active remote session, if any if (HttpContext.Current.Session[HttpSessionStateVariables.RemoteSession.ToString()] != null) { try { if (HttpContext.Current.Session[HttpSessionStateVariables.RemoteSession.ToString()] == null) { throw new NullReferenceException(); } _remoteSession = (RemoteSession)HttpContext.Current.Session[HttpSessionStateVariables.RemoteSession.ToString()]; } catch (Exception exc) { System.Diagnostics.Trace.TraceError("Failed to retrieve the remote session ({0})", exc); } } // ensure there is an active remote session // if a domain is specified, the roaming user profile is loaded from the Active Directory // file storage is synchronized with the user "My documents" folder (will use folder redirection if defined) // user credentials will be checked prior to any file operation // if possible, use SSL to communicate with the service if (_remoteSession != null && (_remoteSession.State == RemoteSessionState.Connecting || _remoteSession.State == RemoteSessionState.Connected) && (_remoteSession.ServerAddress.ToLower() == "localhost" || _remoteSession.ServerAddress == "127.0.0.1" || _remoteSession.ServerAddress == HttpContext.Current.Request.Url.Host || !string.IsNullOrEmpty(_remoteSession.UserDomain)) && !string.IsNullOrEmpty(_remoteSession.UserName) && !string.IsNullOrEmpty(_remoteSession.UserPassword)) { _fileStorageClient = new FileStorageClient(); var files = _fileStorageClient.GetUserDocumentsFolderFiles( _remoteSession.Id, _remoteSession.UserDomain, _remoteSession.UserName, _remoteSession.UserPassword); if (files.Count > 0) { fileToDownloadSelect.DataSource = files; fileToDownloadSelect.DataBind(); downloadFileButton.Disabled = false; } } } catch (Exception exc) { System.Diagnostics.Trace.TraceError("Failed to init file storage ({0})", exc); } }
/// <summary> /// page init /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Init( object sender, EventArgs e) { _fileStorageClient = new FileStorageClient(); }