diff --git a/AssemblyVersion.cs b/AssemblyVersion.cs index 41a01a7..21cc6b6 100644 --- a/AssemblyVersion.cs +++ b/AssemblyVersion.cs @@ -16,5 +16,5 @@ using System.Reflection; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.1.444")] -[assembly: AssemblyFileVersion("3.0.1.444")] +[assembly: AssemblyVersion("3.0.1.445")] +[assembly: AssemblyFileVersion("3.0.1.445")] diff --git a/WebApplication/Edit.aspx.cs b/WebApplication/Edit.aspx.cs index da048ac..b451aa0 100644 --- a/WebApplication/Edit.aspx.cs +++ b/WebApplication/Edit.aspx.cs @@ -427,7 +427,16 @@ namespace ScrewTurn.Wiki { protected void btnCancel_Click(object sender, EventArgs e) { if(currentPage == null && txtName.Visible) currentPage = Pages.FindPage(NameTools.GetFullName(DetectNamespace(), txtName.Text)); - if(currentPage != null) UrlTools.Redirect(Tools.UrlEncode(currentPage.FullName) + Settings.PageExtension); + if(currentPage != null) { + // Try redirecting to proper section + string anchor = null; + if(currentSection != -1) { + int start, len; + ExtractSection(Content.GetPageContent(currentPage, true).Content, currentSection, out start, out len, out anchor); + } + + UrlTools.Redirect(Tools.UrlEncode(currentPage.FullName) + Settings.PageExtension + (anchor != null ? ("#" + anchor + "_" + currentSection.ToString()) : "")); + } else UrlTools.Redirect(UrlTools.BuildUrl("Default.aspx")); } @@ -653,7 +662,7 @@ namespace ScrewTurn.Wiki { if(redirect) { Collisions.CancelEditingSession(currentPage, username); string target = UrlTools.BuildUrl(Tools.UrlEncode(currentPage.FullName), Settings.PageExtension, "?NoRedirect=1", - (!string.IsNullOrEmpty(anchor) ? ("#" + anchor) : "")); + (!string.IsNullOrEmpty(anchor) ? ("#" + anchor + "_" + currentSection.ToString()) : "")); UrlTools.Redirect(target); } }