eric_the_animal
eric_the_animal

Reputation: 432

ASP.NET Hyperlink control will not navigate to url

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.

Upvotes: 0

Views: 1536

Answers (3)

meda
meda

Reputation: 45490

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>

Upvotes: 2

Rashmin Javiya
Rashmin Javiya

Reputation: 5222

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.

Upvotes: 1

Pepto
Pepto

Reputation: 1444

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.

Upvotes: 2

Related Questions