Last post Jul 07, 2017 02:24 AM by hkbeer
Jul 06, 2017 02:07 AM|hkbeer|LINK
My apps location is localhost/MyApp/Default.aspx and this page is loading correctly
I have a navbar on Site.master
My href on this navbar is like this <a href="~/Preview.aspx">
However it goes to localhost/MyApp/~/Preview.aspx so it cannot find it
If I change to <a href="/Preview.aspx">
Then it goes to localhost/Preview.aspx
so again it cannot find it.
How should I modify the href here so it loads correctly to localhost/MyApp/Preview.aspx ?
Jul 06, 2017 07:22 AM|hkholakiya|LINK
Please try just below it is working for me in my application:
Hope it works for you also.
Jul 06, 2017 07:31 AM|PatriceSc|LINK
Or add a runat="server" attribute. ~ is a server side notation and so href needs to be processed before rendering the final client side url which is done if you turn this raw html markup into a server side contorl
Jul 07, 2017 02:24 AM|hkbeer|LINK
Putting runat="server" works. Thanks