private void InitData() { Groups = CoreContext.UserManager.GetDepartments().Select(r => new MyGroup(r)).ToList(); Groups.Sort((group1, group2) => String.Compare(group1.Title, group2.Title, StringComparison.Ordinal)); Profiles = CoreContext.UserManager.GetUsers().ToList(); HasPendingProfiles = Profiles.FindAll(u => u.ActivationStatus == EmployeeActivationStatus.Pending).Count > 0; EnableAddUsers = TenantStatisticsProvider.GetUsersCount() < TenantExtra.GetTenantQuota().ActiveUsers; CurrentUserFullAdmin = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).IsAdmin(); CurrentUserAdmin = CurrentUserFullAdmin || WebItemSecurity.IsProductAdministrator(WebItemManager.PeopleProductID, SecurityContext.CurrentAccount.ID); }
public long MaxChunkedUploadSize(TenantExtra tenantExtra, TenantStatisticsProvider tenantStatisticsProvider) { var diskQuota = tenantExtra.GetTenantQuota(); if (diskQuota != null) { var usedSize = tenantStatisticsProvider.GetUsedSize(); var freeSize = Math.Max(diskQuota.MaxTotalSize - usedSize, 0); return(Math.Min(freeSize, diskQuota.MaxFileSize)); } return(ChunkUploadSize); }
public object GetTenantExtra() { return(new { opensource = TenantExtra.Opensource, enterprise = TenantExtra.Enterprise, tariff = TenantExtra.GetCurrentTariff(), quota = TenantExtra.GetTenantQuota(), notPaid = TenantStatisticsProvider.IsNotPaid(), licenseAccept = Web.Studio.UserControls.Management.TariffSettings.LicenseAccept }); }
public AjaxResponse RequestPayPal(int qoutaId) { var res = new AjaxResponse(); try { if (!HttpRuntime.Cache.Get(PartnerCache).Equals(DateTime.UtcNow)) { HttpRuntime.Cache.Insert(PartnerCache, DateTime.UtcNow); } var partnerId = CoreContext.TenantManager.GetCurrentTenant().PartnerId; var partner = CoreContext.PaymentManager.GetPartner(partnerId); if (partner == null || partner.Status != PartnerStatus.Approved || partner.Removed || partner.PaymentMethod != PartnerPaymentMethod.PayPal) { throw new MethodAccessException(Resource.PartnerPayPalExc); } var tenantQuota = TenantExtra.GetTenantQuota(qoutaId); var curruntQuota = TenantExtra.GetTenantQuota(); if (TenantExtra.GetCurrentTariff().State == TariffState.Paid && tenantQuota.ActiveUsers < curruntQuota.ActiveUsers && tenantQuota.Year == curruntQuota.Year) { throw new MethodAccessException(Resource.PartnerPayPalDowngrade); } if (tenantQuota.Price > partner.AvailableCredit) { CoreContext.PaymentManager.RequestClientPayment(partnerId, qoutaId, false); throw new Exception(Resource.PartnerRequestLimitInfo); } var usersCount = TenantStatisticsProvider.GetUsersCount(); var usedSize = TenantStatisticsProvider.GetUsedSize(); if (tenantQuota.ActiveUsers < usersCount || tenantQuota.MaxTotalSize < usedSize) { res.rs2 = "quotaexceed"; return(res); } res.rs1 = CoreContext.PaymentManager.GetButton(partner.Id, qoutaId); } catch (Exception e) { res.message = e.Message; } return(res); }
public FileUploadResult ProcessUpload(HttpContext context) { var result = new FileUploadResult(); try { if (!SecurityContext.IsAuthenticated && WizardSettings.Load().Completed) { throw new SecurityException(Resource.PortalSecurity); } if (context.Request.Files.Count == 0) { throw new Exception(Resource.ErrorEmptyUploadFileSelected); } var licenseFile = context.Request.Files[0]; var dueDate = LicenseReader.SaveLicenseTemp(licenseFile.InputStream); result.Message = dueDate >= DateTime.UtcNow.Date ? Resource.LicenseUploaded : string.Format( (TenantExtra.GetTenantQuota().Update ? Resource.LicenseUploadedOverdueSupport : Resource.LicenseUploadedOverdue), "<span class='tariff-marked'>", "</span>", dueDate.Date.ToLongDateString()); result.Success = true; } catch (LicenseExpiredException ex) { Log.Error("License upload", ex); result.Message = Resource.LicenseErrorExpired; } catch (LicenseQuotaException ex) { Log.Error("License upload", ex); result.Message = Resource.LicenseErrorQuota; } catch (LicensePortalException ex) { Log.Error("License upload", ex); result.Message = Resource.LicenseErrorPortal; } catch (Exception ex) { Log.Error("License upload", ex); result.Message = Resource.LicenseError; } return(result); }
public DocuSignHandlerService( IOptionsMonitor <ILog> optionsMonitor, TenantExtra tenantExtra, DocuSignHelper docuSignHelper, SecurityContext securityContext, NotifyClient notifyClient) { TenantExtra = tenantExtra; DocuSignHelper = docuSignHelper; SecurityContext = securityContext; NotifyClient = notifyClient; Log = optionsMonitor.CurrentValue; }
protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); _valideShareLink = !string.IsNullOrEmpty(FileShareLink.Parse(RequestShareLinkKey)); CheckAuth(); if (!TenantExtra.GetTenantQuota().DocsEdition) { Response.Redirect(CommonLinkUtility.FileHandlerPath + "?" + Context.Request.QueryString + (string.IsNullOrEmpty(Context.Request[CommonLinkUtility.Action]) ? "&" + CommonLinkUtility.Action + "=view" : string.Empty)); } }
protected void Page_Load(object sender, EventArgs e) { Page.RegisterBodyScripts("~/usercontrols/management/tariffsettings/js/tarifflimitexceed.js"); Page.RegisterStyle("~/usercontrols/management/tariffsettings/css/tarifflimitexceed.less"); tariffLimitExceedUsersDialog.Options.IsPopup = true; tariffLimitExceedStorageDialog.Options.IsPopup = true; tariffLimitExceedFileSizeDialog.Options.IsPopup = true; var quota = TenantExtra.GetTenantQuota(); IsFreeTariff = (quota.Free || quota.NonProfit || quota.Trial) && !quota.Open; }
public void GetFree() { var quota = TenantExtra.GetTenantQuota(); var usersCount = TenantStatisticsProvider.GetUsersCount(); var usedSize = TenantStatisticsProvider.GetUsedSize(); if (!quota.Free && quota.ActiveUsers >= usersCount && quota.MaxTotalSize >= usedSize) { TenantExtra.FreeRequest(); } }
public StudioSmsNotificationSettingsHelper( TenantExtra tenantExtra, CoreBaseSettings coreBaseSettings, SetupInfo setupInfo, SettingsManager settingsManager, SmsProviderManager smsProviderManager) { TenantExtra = tenantExtra; CoreBaseSettings = coreBaseSettings; SetupInfo = setupInfo; SettingsManager = settingsManager; SmsProviderManager = smsProviderManager; }
protected void Page_Load(object sender, EventArgs e) { Page.RegisterBodyScripts("~/js/uploader/ajaxupload.js"); Page.RegisterBodyScripts("~/usercontrols/management/tariffsettings/js/tariffstandalone.js"); Page.RegisterStyle("~/usercontrols/management/tariffsettings/css/tariff.less"); Page.RegisterStyle("~/usercontrols/management/tariffsettings/css/tariffstandalone.less"); UsersCount = TenantStatisticsProvider.GetUsersCount(); CurrentTariff = TenantExtra.GetCurrentTariff(); CurrentQuota = TenantExtra.GetTenantQuota(); AjaxPro.Utility.RegisterTypeForAjax(GetType()); }
private static void DemandPermissionsTransfer() { SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings); var currentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID); if (!SetupInfo.IsVisibleSettings(ManagementType.Migration.ToString()) || !currentUser.IsOwner() || !SetupInfo.IsSecretEmail(currentUser.Email) && !TenantExtra.GetTenantQuota().HasMigration) { throw new InvalidOperationException(Resource.ErrorNotAllowedOption); } }
protected string RenderUsersTotal() { var result = TenantStatisticsProvider.GetUsersCount().ToString(); var maxActiveUsers = TenantExtra.GetTenantQuota().ActiveUsers; if (!CoreContext.Configuration.Standalone || maxActiveUsers != LicenseReader.MaxUserCount) { result += " / " + maxActiveUsers; } return(result); }
public void Deconstruct(out TenantManager tenantManager, out UserManager userManager, out SecurityContext securityContext, out StudioNotifyHelper studioNotifyHelper, out TenantExtra tenantExtra, out CoreBaseSettings coreBaseSettings) { tenantManager = TenantManager; userManager = UserManager; securityContext = SecurityContext; studioNotifyHelper = StudioNotifyHelper; tenantExtra = TenantExtra; coreBaseSettings = CoreBaseSettings; }
protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); if (CoreContext.Configuration.Personal) { Context.Response.Redirect(FilesLinkUtility.FilesBaseAbsolutePath); } if (TenantExtra.GetCurrentTariff().State < TariffState.NotPaid) { Response.Redirect(CommonLinkUtility.GetDefault(), true); } }
protected void Page_Load(object sender, EventArgs e) { LinkText = CustomNamingPeople.Substitute <Resource>("InviteUsersToPortalLink").HtmlEncode(); if (CoreContext.Configuration.Personal) { EnableAddUsers = true; EnableAddVisitors = true; } else { EnableAddUsers = TenantStatisticsProvider.GetUsersCount() < TenantExtra.GetTenantQuota().ActiveUsers; EnableAddVisitors = CoreContext.Configuration.Standalone || TenantStatisticsProvider.GetVisitorsCount() < TenantExtra.GetTenantQuota().ActiveUsers *Constants.CoefficientOfVisitors; } }
protected void Page_Load(object sender, EventArgs e) { TariffPageLink = TenantExtra.GetTariffPageLink(); Page.RegisterBodyScripts("~/UserControls/Management/AuditTrail/js/audittrail.js") .RegisterStyle("~/UserControls/Management/AuditTrail/css/audittrail.less"); var emptyScreenControl = new EmptyScreenControl { ImgSrc = WebPath.GetPath("UserControls/Management/AuditTrail/img/audit_trail_empty_screen.jpg"), Header = AuditResource.AuditTrailEmptyScreenHeader, Describe = AuditResource.AuditTrailEmptyScreenDscr }; emptyScreenHolder.Controls.Add(emptyScreenControl); }
public QuotaWrapper(TenantQuota quota, IList <TenantQuotaRow> quotaRows) { StorageSize = (ulong)Math.Max(0, quota.MaxTotalSize); UsedSize = (ulong)Math.Max(0, quotaRows.Sum(r => r.Counter)); MaxFileSize = Math.Min(AvailableSize, (ulong)quota.MaxFileSize); MaxUsersCount = TenantExtra.GetTenantQuota().ActiveUsers; UsersCount = TenantStatisticsProvider.GetUsersCount(); StorageUsage = quotaRows .Select(x => new QuotaUsage { Path = x.Path.TrimStart('/').TrimEnd('/'), Size = x.Counter, }) .ToList(); }
protected void Page_Load(object sender, EventArgs e) { AjaxPro.Utility.RegisterTypeForAjax(GetType()); Page.RegisterBodyScripts(ResolveUrl("~/usercontrols/Management/StudioSettings/studiosettings.js")); //transfer portal _transferPortalSettings.Controls.Add(LoadControl(TransferPortal.Location)); //timezone & language _timelngHolder.Controls.Add(LoadControl(TimeAndLanguage.Location)); if (SetupInfo.IsVisibleSettings <PromoCode>() && TenantExtra.GetCurrentTariff().State == ASC.Core.Billing.TariffState.Trial && string.IsNullOrEmpty(CoreContext.TenantManager.GetCurrentTenant().PartnerId)) { promoCodeSettings.Controls.Add(LoadControl(PromoCode.Location)); } //Portal version if (SetupInfo.IsVisibleSettings <VersionSettings.VersionSettings>() && 1 < CoreContext.TenantManager.GetTenantVersions().Count()) { _portalVersionSettings.Controls.Add(LoadControl(VersionSettings.VersionSettings.Location)); } //main domain settings _mailDomainSettings.Controls.Add(LoadControl(MailDomainSettings.Location)); //strong security password settings _strongPasswordSettings.Controls.Add(LoadControl(PasswordSettings.Location)); //invitational link invLink.Controls.Add(LoadControl(InviteLink.Location)); //sms settings if (SetupInfo.IsVisibleSettings <StudioSmsNotificationSettings>() && CoreContext.PaymentManager.GetApprovedPartner() == null) { _smsValidationSettings.Controls.Add(LoadControl(SmsValidationSettings.Location)); } //admin message settings _admMessSettings.Controls.Add(LoadControl(AdminMessageSettings.Location)); //default page settings _defaultPageSeettings.Controls.Add(LoadControl(DefaultPageSettings.Location)); /*if (CoreContext.Configuration.Standalone) * { * _uploadHttpsSeettings.Controls.Add(LoadControl(UploadHttps.Location)); * }*/ }
protected override void PageLoad() { if (!Participant.IsFullAdmin || Participant.IsVisitor) { HttpContext.Current.Response.Redirect(PathProvider.BaseVirtualPath, true); } if (TenantExtra.GetRemainingCountUsers() <= 0) { QuotaEndFlag = true; } InitPage(); }
public StudioNotifyServiceSenderScope(TenantManager tenantManager, UserManager userManager, SecurityContext securityContext, StudioNotifyHelper studioNotifyHelper, TenantExtra tenantExtra, CoreBaseSettings coreBaseSettings) { TenantManager = tenantManager; UserManager = userManager; SecurityContext = securityContext; StudioNotifyHelper = studioNotifyHelper; TenantExtra = tenantExtra; CoreBaseSettings = coreBaseSettings; }
protected override IEnumerable <KeyValuePair <string, object> > GetClientVariables(HttpContext context) { yield return(RegisterObject("ApiPath", SetupInfo.WebApiBaseUrl)); yield return(RegisterObject("MaxImageFCKWidth", System.Configuration.ConfigurationManager.AppSettings["MaxImageFCKWidth"] ?? "620")); yield return(RegisterObject("IsAuthenticated", SecurityContext.IsAuthenticated)); yield return(RegisterObject("IsAdmin", CoreContext.UserManager.IsUserInGroup(SecurityContext.CurrentAccount.ID, ASC.Core.Users.Constants.GroupAdmin.ID))); yield return(RegisterObject("CurrentTenantVersion", CoreContext.TenantManager.GetCurrentTenant().Version)); yield return(RegisterObject("CurrentTenantUtcOffset", CoreContext.TenantManager.GetCurrentTenant().TimeZone)); yield return(RegisterObject("CurrentTenantUtcHoursOffset", CoreContext.TenantManager.GetCurrentTenant().TimeZone.GetUtcOffset(DateTime.UtcNow).Hours)); yield return(RegisterObject("CurrentTenantUtcMinutesOffset", CoreContext.TenantManager.GetCurrentTenant().TimeZone.GetUtcOffset(DateTime.UtcNow).Minutes)); yield return(RegisterObject("SetupInfoNotifyAddress", SetupInfo.NotifyAddress)); var curQuota = TenantExtra.GetTenantQuota(); yield return(RegisterObject("TenantQuotaIsTrial", curQuota.Trial ? "No" : "Yes")); yield return(RegisterObject("TenantTariff", curQuota.Id)); yield return(RegisterObject("TenantTariffDocsEdition", curQuota.DocsEdition)); if (CoreContext.Configuration.YourDocsDemo) { yield return(RegisterObject("YourDocsDemo", CoreContext.Configuration.YourDocsDemo)); } yield return(RegisterObject("ShowPromotions", SettingsManager.Instance.LoadSettings <StudioNotifyBarSettings>(TenantProvider.CurrentTenantID).ShowPromotions)); yield return(RegisterObject("EmailRegExpr", @"^(([^<>()[\]\\.,;:\s@\""]+(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$")); yield return(RegisterObject("UserPhotoHandlerUrl", VirtualPathUtility.ToAbsolute("~/UserPhoto.ashx"))); yield return(RegisterObject("ImageWebPath", WebImageSupplier.GetImageFolderAbsoluteWebPath())); yield return(RegisterObject("GroupSelector_MobileVersionGroup", new { Id = -1, Name = Resources.UserControlsCommonResource.LblSelect.HtmlEncode().ReplaceSingleQuote() })); yield return(RegisterObject("GroupSelector_WithGroupEveryone", new { Id = ASC.Core.Users.Constants.GroupEveryone.ID, Name = Resources.UserControlsCommonResource.Everyone.HtmlEncode().ReplaceSingleQuote() })); yield return(RegisterObject("GroupSelector_WithGroupAdmin", new { Id = ASC.Core.Users.Constants.GroupAdmin.ID, Name = Resources.UserControlsCommonResource.Admin.HtmlEncode().ReplaceSingleQuote() })); yield return(RegisterObject("FilterHelpCenterLink", "http://helpcenter.teamlab.com/tipstricks/using-search.aspx")); }
public async Task InvokeAsync(HttpContext context, SetupInfo setupInfo, DaoFactory daoFactory, FileSizeComment fileSizeComment, IServiceProvider serviceProvider, TenantExtra tenantExtra, TenantStatisticsProvider tenantStatisticsProvider) { context.Request.EnableBuffering(); var fileUploadResult = new FileUploadResult(); if (context.Request.Form.Files.Count == 0) { await context.Response.WriteAsync(JsonSerializer.Serialize(fileUploadResult)); } var fileName = context.Request.Form.Files[0].FileName; var contentLength = context.Request.Form.Files[0].Length; if (String.IsNullOrEmpty(fileName) || contentLength == 0) { throw new InvalidOperationException(CRMErrorsResource.InvalidFile); } if (0 < setupInfo.MaxUploadSize(tenantExtra, tenantStatisticsProvider) && setupInfo.MaxUploadSize(tenantExtra, tenantStatisticsProvider) < contentLength) { throw fileSizeComment.FileSizeException; } fileName = fileName.LastIndexOf('\\') != -1 ? fileName.Substring(fileName.LastIndexOf('\\') + 1) : fileName; var document = serviceProvider.GetService <File <int> >(); document.Title = fileName; document.FolderID = daoFactory.GetFileDao().GetRoot(); document.ContentLength = contentLength; document = daoFactory.GetFileDao().SaveFile(document, context.Request.Form.Files[0].OpenReadStream()); fileUploadResult.Data = document.ID; fileUploadResult.FileName = document.Title; fileUploadResult.FileURL = document.DownloadUrl; fileUploadResult.Success = true; await context.Response.WriteAsync(JsonSerializer.Serialize(fileUploadResult)); }
protected void Page_Load(object sender, EventArgs e) { Page.RegisterBodyScripts("~/UserControls/EmptyScreens/js/dashboard.js", "~/js/third-party/slick.min.js"); var collaboratorPopupSettings = CollaboratorSettings.LoadForCurrentUser(); collaboratorPopupSettings.FirstVisit = false; collaboratorPopupSettings.SaveForCurrentUser(); var quota = TenantExtra.GetTenantQuota(); var isAdministrator = CoreContext.UserManager.IsUserInGroup(SecurityContext.CurrentAccount.ID, ASC.Core.Users.Constants.GroupAdmin.ID); var showDemonstration = !CoreContext.Configuration.Personal && !CoreContext.Configuration.CustomMode && !CoreContext.Configuration.Standalone && quota.Trial; ProductDemo = !string.IsNullOrEmpty(SetupInfo.DemoOrder) && isAdministrator && showDemonstration; }
public DocuSignHandler( RequestDelegate next, IOptionsMonitor <ILog> optionsMonitor, TenantExtra tenantExtra, DocuSignHelper docuSignHelper, SecurityContext securityContext, NotifyClient notifyClient) { Next = next; TenantExtra = tenantExtra; DocuSignHelper = docuSignHelper; SecurityContext = securityContext; NotifyClient = notifyClient; Log = optionsMonitor.CurrentValue; }
public static int CheckUsersQuota(string url, string userName, string password) { var basecampManager = BaseCamp.GetInstance(ImportFromBasecamp.PrepUrl(url).ToString().TrimEnd('/') + "/api/v1", userName, password); var countImportedUsers = basecampManager.People.Count(); var remainingAmount = TenantExtra.GetRemainingCountUsers(); if (remainingAmount == 0) { return(0); } var difference = remainingAmount - countImportedUsers; return(difference >= 0 ? remainingAmount : -remainingAmount); }
public static string GetLink(File file) { var url = file.ViewUrl; if (!FileUtility.CanImageView(file.Title) && TenantExtra.GetTenantQuota().DocsEdition) { url = FilesLinkUtility.GetFileWebPreviewUrl(file.Title, file.ID); } var linkParams = CreateKey(file.ID.ToString()); url += "&" + FilesLinkUtility.DocShareKey + "=" + HttpUtility.UrlEncode(linkParams); return(CommonLinkUtility.GetFullAbsolutePath(url)); }
protected void Page_Load(object sender, EventArgs e) { Master.DisabledSidePanel = true; if (TenantStatisticsProvider.IsNotPaid()) { Master.TopStudioPanel.DisableProductNavigation = true; Master.TopStudioPanel.DisableSettings = true; Master.TopStudioPanel.DisableSearch = true; Master.TopStudioPanel.DisableGift = true; } Title = HeaderStringHelper.GetPageTitle(Resource.Tariffs); if (Request.DesktopApp()) { Master.DisabledTopStudioPanel = true; pageContainer.Controls.Add(LoadControl(TariffDesktop.Location)); } else if (CoreContext.Configuration.Standalone) { pageContainer.Controls.Add(LoadControl(TariffStandalone.Location)); } else { if (CoreContext.Configuration.CustomMode) { pageContainer.Controls.Add(LoadControl(TariffCustom.Location)); } else { pageContainer.Controls.Add(LoadControl(TariffSaas.Location)); //pageContainer.Controls.Add(LoadControl(TariffUsage.Location)); } var payments = CoreContext.PaymentManager.GetTariffPayments(TenantProvider.CurrentTenantID).ToList(); if (payments.Any() && !TenantExtra.GetTenantQuota().Trial && CoreContext.UserManager.IsUserInGroup(SecurityContext.CurrentAccount.ID, ASC.Core.Users.Constants.GroupAdmin.ID)) { var tariffHistory = (TariffHistory)LoadControl(TariffHistory.Location); tariffHistory.Payments = payments; pageContainer.Controls.Add(tariffHistory); } } pageContainer.Controls.Add(LoadControl(SupportChat.Location)); }
private UserInfo AddUser(UserInfo userInfo) { UserInfo newUserInfo; try { newUserInfo = userInfo.Clone() as UserInfo; if (newUserInfo == null) { return(Constants.LostUser); } _log.DebugFormat("Adding or updating user in database, userId={0}", userInfo.ID); SecurityContext.CurrentAccount = ASC.Core.Configuration.Constants.CoreSystem; if (string.IsNullOrEmpty(newUserInfo.UserName)) { var limitExceeded = TenantStatisticsProvider.GetUsersCount() >= TenantExtra.GetTenantQuota().ActiveUsers; newUserInfo = UserManagerWrapper.AddUser(newUserInfo, UserManagerWrapper.GeneratePassword(), true, false, isVisitor: limitExceeded); } else { if (!UserFormatter.IsValidUserName(userInfo.FirstName, userInfo.LastName)) { throw new Exception(Resource.ErrorIncorrectUserName); } CoreContext.UserManager.SaveUserInfo(newUserInfo); } /*var photoUrl = samlResponse.GetRemotePhotoUrl(); * if (!string.IsNullOrEmpty(photoUrl)) * { * var photoLoader = new UserPhotoLoader(); * photoLoader.SaveOrUpdatePhoto(photoUrl, userInfo.ID); * }*/ } finally { SecurityContext.Logout(); } return(newUserInfo); }
public override void OnProcessRequest(HttpContext context) { if (TenantStatisticsProvider.IsNotPaid()) { context.Response.Redirect(TenantExtra.GetTariffPageLink()); } try { switch ((context.Request[FilesLinkUtility.Action] ?? "").ToLower()) { case "view": DownloadFile(context, true); break; case "download": DownloadFile(context, false); break; case "bulk": BulkDownloadFile(context); break; case "stream": StreamFile(context); break; case "create": CreateFile(context); break; case "redirect": Redirect(context); break; case "track": TrackFile(context); break; default: throw new HttpException((int)HttpStatusCode.BadRequest, FilesCommonResource.ErrorMassage_BadRequest); } } catch (InvalidOperationException e) { throw new HttpException((int)HttpStatusCode.InternalServerError, FilesCommonResource.ErrorMassage_BadRequest, e); } }