protected void PageLoad() { File file; try { ShareLink = Request[UrlConstant.DocUrlKey] ?? ""; WithLink = !string.IsNullOrEmpty(ShareLink); var fileId = WithLink ? (object)-1 : Request[UrlConstant.FileId]; FileNew = !string.IsNullOrEmpty(Request[UrlConstant.New]) && Request[UrlConstant.New] == "true"; var ver = string.IsNullOrEmpty(Request[UrlConstant.Version]) ? -1 : Convert.ToInt32(Request[UrlConstant.Version]); file = DocumentUtils.GetServiceParams(false, fileId, ver, FileNew, ShareLink, out DocParams); } catch (Exception ex) { ErrorMessage = ex.Message; return; //var urlRedirect = Request.UrlReferrer == null // ? PathProvider.StartURL // : Request.UrlReferrer.ToString(); //Response.Redirect(urlRedirect + "#" + UrlConstant.Error + "/" + HttpUtility.UrlEncode(ex.Message)); } if (!FileUtility.UsingHtml5(file.Title, false)) { Server.Transfer("viewer.aspx", true); } Title = file.Title; DocParams.Type = MobileDetector.IsRequestMatchesMobile(Context) ? "mobile" : "desktop"; if (MobileDetector.IsRequestMatchesMobile(Context)) { DocParams.FolderUrl = string.Empty; } DocKeyForTrack = DocumentUtils.GetDocKey(file.ID, -1, DateTime.MinValue); Global.DaoFactory.GetTagDao().RemoveTags(Tag.New(SecurityContext.CurrentAccount.ID, file)); FilesActivityPublisher.OpenEditorFile(file); }
protected void PageLoad() { var file = new File(); try { ShareLink = Request[UrlConstant.DocUrlKey] ?? ""; WithLink = !string.IsNullOrEmpty(ShareLink); var fileId = WithLink ? (object)-1 : Request[UrlConstant.FileId]; FileNew = !string.IsNullOrEmpty(Request[UrlConstant.New]) && Request[UrlConstant.New] == "true"; file = DocumentUtils.GetServiceParams(true, fileId, 0, FileNew, ShareLink, out DocParams); } catch (Exception ex) { Response.Redirect(PathProvider.BaseVirtualPath + "docviewer.aspx" + "?" + Request.QueryString + "#" + UrlConstant.Error + "/" + HttpUtility.UrlEncode(ex.Message)); } if (!FileUtility.UsingHtml5(file.Title)) { Server.Transfer("editor.aspx", true); } Title = file.Title; DocParams.Type = MobileDetector.IsRequestMatchesMobile(Context) ? "mobile" : "desktop"; DocKeyForTrack = DocumentUtils.GetDocKey(file.ID, -1, DateTime.MinValue); using (var tagDao = Global.DaoFactory.GetTagDao()) { tagDao.RemoveTags(Tag.New(SecurityContext.CurrentAccount.ID, file)); } FilesActivityPublisher.OpenEditorFile(file); FileLocker.Add(file.ID); }