I understand that people have answered the similar questions but this problem is specific to my case.
We had a big application with its different modules just segregated by being kept in different folders. We revamped the design and made a different website for each module and made the whole big application comprising of loosely coupled modules(websites).
Previously, urls used to be
www.something.com/rootname/modules/Module1/SubModule1/PageName.aspx
Now they are
www.something.com/Module1/PageName.aspx
Now there are certain pages in the application that are common for all websites, like homepage, change password page etc, which have the same paths as before, like
www.something.com/rootname/modules/central/PageName.aspx
So, in each of the websites, their master pages contain links to these pages like
<a class="lbDashboard" href="../../rootname/Modules/Central/Default.aspx" id="lbHome" runat="server">Dashboard</a>
Everything is working fine and the links with href containing "../../" work fine, but after successfully calling a webmethod through an ajax request, it shows this exception. I have also tried replacing it with "../" but in vain. Removing it suppress the exception but the links wont work then.
The 'href' property had a malformed URL: Cannot use a leading .. to exit above the top directory.. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The 'href' property had a malformed URL: Cannot use a leading .. to exit above the top directory..
Source Error:
[No relevant source lines]
Source File: c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\payroll\8e6d33db\c78ffaf0\App_Web_masterpage.master.cdcab7d2.0mity0ya.0.cs Line: 0
Stack Trace:
[HttpException (0x80004005): The 'href' property had a malformed URL: Cannot use a leading .. to exit above the top directory..]
System.Web.UI.HtmlControls.HtmlControl.PreProcessRelativeReferenceAttribute(HtmlTextWriter writer, String attribName) +201
System.Web.UI.HtmlControls.HtmlAnchor.RenderAttributes(HtmlTextWriter writer) +93
System.Web.UI.HtmlControls.HtmlControl.RenderBeginTag(HtmlTextWriter writer) +42
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +19
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
ASP.masterpage_master.__RenderpageForm(HtmlTextWriter __w, Control parameterContainer) in c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\payroll\8e6d33db\c78ffaf0\App_Web_masterpage.master.cdcab7d2.0mity0ya.0.cs:0 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +173
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +31
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +53 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060