Question

I have a hyperlink that does not navigate to the set URL. It is dead simple I have no idea what is wrong. The link in my aspx page:

<asp:HyperLink ID="HyperLinkLostPass" runat="server"  
   Text="Forgot username or password?" NavigateUrl="~/test.aspx" Target="_self">    </asp:HyperLink>

When I click the hyperlink the test page doesn't load, the navigation bar shows: theserver:33072/websitename/Default.aspx?ReturnUrl=%2fWebHCV3%2ftest.aspx

and I stay on Default.aspx.

There is no code behind written for test.aspx (simple page that reads 'TEST') and it resides in the same folder as Default.aspx.

Was it helpful?

Solution

You can solve this by adding the following to your web.config file:

  <location path="test.aspx">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>

OTHER TIPS

I think the url pointed to at ~/test.aspx is sitting behind your Forms Authentication path and is therefore being redirected by the server to what you have setup as your login page (Note: the ReturnUrl=path in your navigation bar.

Please review your web.config entries and ensure your path to test.aspx is allowed to be viewed by Anonymous requests.

You have used authentication in your application. you are redirected to default because root directory has restricted except for default.aspx.

Just check your web.config file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top