diff --git a/DNN Platform/Website/admin/Modules/Export.ascx.cs b/DNN Platform/Website/admin/Modules/Export.ascx.cs index 2b310bf22ba..31ee0b865e6 100644 --- a/DNN Platform/Website/admin/Modules/Export.ascx.cs +++ b/DNN Platform/Website/admin/Modules/Export.ascx.cs @@ -219,23 +219,24 @@ protected void OnExportClick(object sender, EventArgs e) { try { + IFolderInfo folder = null; if (cboFolders.SelectedItem != null && !String.IsNullOrEmpty(txtFile.Text)) { - var folder = FolderManager.Instance.GetFolder(cboFolders.SelectedItemValueAsInt); - if (folder != null) + folder = FolderManager.Instance.GetFolder(cboFolders.SelectedItemValueAsInt); + } + + if (folder != null) + { + var strFile = "content." + CleanName(Module.DesktopModule.ModuleName) + "." + CleanName(txtFile.Text) + ".export"; + var strMessage = ExportModule(ModuleId, strFile, folder); + if (String.IsNullOrEmpty(strMessage)) { - var strFile = "content." + CleanName(Module.DesktopModule.ModuleName) + "." + CleanName(txtFile.Text) + ".export"; - var strMessage = ExportModule(ModuleId, strFile, folder); - if (String.IsNullOrEmpty(strMessage)) - { - Response.Redirect(ReturnURL, true); - } - else - { - UI.Skins.Skin.AddModuleMessage(this, strMessage, ModuleMessage.ModuleMessageType.RedError); - } + Response.Redirect(ReturnURL, true); + } + else + { + UI.Skins.Skin.AddModuleMessage(this, strMessage, ModuleMessage.ModuleMessageType.RedError); } - } else {