ASP.Net View - Inspector in SOURCES shows link as 'Relative' then in ELEMENTS shows link as 'Absolute'

24 views Asked by At

I have a Visual Studio 2015 ASP.Net project and going around in circles, I have been debugging the code like mad but the issue I am having 'appears' to be at render view which I can't debug, I get to output.string and the html is correct with a relative link and hey presto on the web page inspector elements it's absolute . There could be a setting at the beginning of the code compile that is causing the issue but I can't find it.

All 'a href' links are rendering as ABSOLUTE, when I have them set up as RELATIVE

Example 1: Site.Master, menu option

Hardcoded HTML

<a href='/Site/AboutUs'>About Us</a>

Inspector - Sources

<a href='/Site/AboutUs'>About Us</a>

Inspector - Elements

<a href="http://localhost:5250/Site/AboutUs">About Us</a>

Example 2: ASCX file code -'Basket Empty' Button

<%= this.Html.CssLinkButton("Basket_Empty", "ConfirmDelete", null, "toggle")%>

Debug - Locals Output String

{<div id="Basket_Empty" class="button"><a href="ConfirmDelete" class="toggle" >Empty Basket</a><div class="button_right"></div></div>}

Inspector - Sources

 <div id="Basket_Empty" class="button"><a href="ConfirmDelete" class="toggle" >Empty Basket</a><div class="button_right"></div></div>

Inspector - Elements

<div id="Basket_Empty" class="button"><a href="http://localhost:5250/Basket/ConfirmDelete" class="toggle">Empty Basket</a><div class="button_right"></div></div>

I was wondering if someone can point me in the right direction as to where to debug / look for how 'Sources' and 'Elements' can show different URL types.

I need 'RELATIVE' paths and the site set up with them but for some strange reason I am ending up with Absolute paths.

I have another site with the same backend code and the 'relative' paths, render as 'relative' paths, so I am not sure why this site is pushing them to absolute. I have checked the config files on both of these sites to compare / look for a flag that may push for absolute over relative but nothing, the same with the SQL db but nothing.

I am sure I am missing something simple. Any help / pointers are much appreciated.

Part Resolved

Update - I am checking my JavaScript files (there are many) as seen from another site that Inspect elements performs: HTML error correction by the browser, HTML normalization by the browser, DOM manipulation by Javascript

Run the site with Javascript Disabled and Yep it's one of my JavaScript files, now to find out which one.

I'm leaving this issue up hopefully to save someone time debugging in VS, when they can try JS enabled off. Mind you people aren't probably as dopey as me.

0

There are 0 answers