private static void RenderToResponseStream(HttpResponse response, XmlBaseController baseController) { // save script timeout var scriptTimeOut = HttpContext.Current.Server.ScriptTimeout; // temporarily set script timeout to large value ( this value is only applicable when application is not running in Debug mode ) HttpContext.Current.Server.ScriptTimeout = int.MaxValue; response.ContentType = baseController.ContentType; response.AppendHeader("content-disposition", "inline; filename=" + baseController.FileName); baseController.Render(response.OutputStream); response.Flush(); // reset script timeout HttpContext.Current.Server.ScriptTimeout = scriptTimeOut; }
/// ----------------------------------------------------------------------------- /// <summary> /// Page_Load runs when the control is loaded /// </summary> /// ----------------------------------------------------------------------------- private void Page_Load(object sender, EventArgs e) { try { _baseController = new XmlBaseController(this); _currentMode = _baseController.CheckShowMode(Request.QueryString["ShowMode"].DefaultIfNullOrEmpty()); var downloadLink = ResolveUrl("~" + Definition.PathOfModule + "download.ashx") + "?tabid=" + TabId + "&mid=" + ModuleId; switch (_currentMode) { case ShowMode.Response: Response.Redirect(downloadLink); break; case ShowMode.Link: lnkShowContent.NavigateUrl = downloadLink; break; default: using (var writer = new StringWriter()) { _baseController.Render(writer); Controls.Clear(); Controls.Add(new LiteralControl(writer.ToString())); } break; } } catch (SecurityException exc) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("CAS.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning); Exceptions.LogException(exc); } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
private void cmdClearSearchIndex_Click(object sender, EventArgs e) { var objController = new XmlBaseController(ModuleConfiguration, Page); objController.ClearSearchIndex(); }
///<summary> /// DotNetNuke Search support ///</summary> public SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo) { var controller = new XmlBaseController(modInfo); var portalId = modInfo.PortalID; var administratorId = new PortalController().GetPortal(portalId).AdministratorId; var searchItemCollection = new SearchItemInfoCollection(); if (MustAddContentToSearch(modInfo)) { var sw = new StringWriter(); controller.Render(sw); sw.Flush(); var content = sw.ToString(); var now = DateTime.Now; searchItemCollection.Add(new SearchItemInfo(modInfo.ModuleTitle, content, administratorId, now, modInfo.ModuleID, "", content)); var mc = new ModuleController(); mc.UpdateModuleSetting(modInfo.ModuleID, Setting.LastIndexRun, DateTime.Now.ToString("s")); } return searchItemCollection; }