简体   繁体   中英

hyperlinks not working when hosted from IIS

I have a web site that is designed in asp.net and working fine in visual studio. However, when I host it from IIS, none of the links work. There is nothing fancy about the links

                    <li><a href = "#">Links</a>
                        <ul>
                            <li><a href="page1.aspx">Page1</a></li>
                            <li><a href="page2.aspx">Page2</a></li>
                        </ul>
                    </li>

this is not cause of hyperlink. Set <customErrors mode="Off"/> in your web.config to see the full error message. Otherwise, it is hard to get why you are getting an error.

visit this link if you need to know more: http://weblogs.asp.net/scottgu/archive/2006/08/12/Tip_2F00_Trick_3A00_-Show-Detailed-Error-Messages-to-Developers.aspx

i'd first set up the custom errors tag in web.config to show all the errors

if that didn't work, i'd have a look at the IIS website and see if it is set up to host the correct version of ASP.NET,

if that still didn't work, i'd check

control panel -> administrative tools -> event viewer -> application

to see the asp.net warning entry that should show the exception message.

it's unlikely to be what you've posted as that looks like ok html.

Just add runat="server" to your anchor tag.

like this,

<a runat="server" href="Home.aspx">Home</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM