Reputation: 53
I have the following code in an ASP.net webforms app. The code is in C# but it's the asp aspect that I seem t be having some problems with. The links work fine in debug, but in release they don't seem to even be available as links.
<asp:Table ID="Table1" runat="server" BackColor="#36A3E4" Width="950px">
<asp:TableRow>
<asp:TableCell VerticalAlign="Middle" HorizontalAlign="Center"><asp:HyperLink ID="lnkShop" runat="server" ForeColor="White" Font-Bold="True" NavigateUrl="ShopListing.aspx?CLS=All">SHOP</asp:HyperLink></asp:TableCell>
<asp:TableCell VerticalAlign="Middle" HorizontalAlign="Center"><asp:HyperLink ID="HyperLink1" runat="server" ForeColor="White" Font-Bold="True" NavigateUrl="~/faq.aspx">FAQ's</asp:HyperLink></asp:TableCell>
<asp:TableCell VerticalAlign="Middle" HorizontalAlign="Center"><asp:HyperLink ID="HyperLink2" runat="server" ForeColor="White" Font-Bold="True" NavigateUrl="~/Feedback.aspx">FEEDBACK</asp:HyperLink></asp:TableCell>
<asp:TableCell VerticalAlign="Middle" HorizontalAlign="Center"><asp:HyperLink ID="HyperLink3" runat="server" ForeColor="White" Font-Bold="True" NavigateUrl="~/Bookmark.aspx">BOOKMARK US</asp:HyperLink></asp:TableCell>
<asp:TableCell VerticalAlign="Middle" HorizontalAlign="Center"><asp:HyperLink ID="HyperLink4" runat="server" ForeColor="White" Font-Bold="True" NavigateUrl="~/About.aspx">ABOUT US</asp:HyperLink></asp:TableCell>
<asp:TableCell VerticalAlign="Middle" HorizontalAlign="Center"><asp:HyperLink ID="HyperLink5" runat="server" ForeColor="White" Font-Bold="True" NavigateUrl="~/Contact.aspx">CONTACT US</asp:HyperLink></asp:TableCell>
<asp:TableCell VerticalAlign="Middle" HorizontalAlign="Center"><asp:TextBox ID="txtSearch" runat="server" Width="125px" Text="Search"></asp:TextBox></asp:TableCell>
<asp:TableCell VerticalAlign="Middle" HorizontalAlign="Center"><asp:Button ID="btnSearch" runat="server" Text="Go" /></asp:TableCell>
</asp:TableRow>
</asp:Table>
I feel that the problem may be with iis and not the code but I can't find anything that's different from any of my other apps. Any pointers would be greatly appreciated.
Thanks.
Upvotes: 1
Views: 2251
Reputation: 1824
I have stumbled upon this once and the solution to my problem was to replace the "~" with ".". For example:
<asp:HyperLink runat="server" NavigateUrl="./Contact.aspx">Test</asp:HyperLink>
Also, if it's not 100% required to use asp controls i would sugest using the tag with Page.ResolveUrl() and let asp handle the page. This one is the best solution in my opinion. For example:
<a href="<%= Page.ResolveUrl("~/Help.aspx") %>">Help</a>
Ps: I add this as answer because i don't have enough rep...
Upvotes: 1