ASP.NET links won't redirect to the right page


From time to time I encounter issues linking to page in Visual Studio when working with ASP.NET application.

I create links to pages but they always redirect to the default one (Default.aspx)

<ul><li>I trying various thing like deleting and recreate</li> <li>Rename the page</li> <li>Even If the page does not exist it still redirects to the defaults page.</li> </ul>

My Login.aspx page is the same folder as ForgotPassword.aspx I create links like this

<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="ForgotPassword.aspx"> Forgot your password ? </asp:HyperLink>


<a href="ForgotPassword.aspx">Forgot your password ?<a>

I am at loss to understand why such basic stuff would fail to work... How can I solve this issue? Could this be a bug?

EDIT: The Url in the browser looks like this:


My webconfig:

<authentication mode="Forms"> <forms loginUrl="~/Account/Login.aspx" timeout="2880" /> </authentication>


I solve this by adding the following to my web.config file:

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


What happens when you compile your web site? If Visual Studio cannot find your ForgotPassword.aspx page, you should get a Warning in your Error List that says "File 'ForgotPassword.aspx' was not found." Note that this will appear in the Error List tab, not the Output tab.

Assuming you are not getting this warning...hmm. The only thing that pops into my head is maybe you have a default behavior specified? If it cannot find the page specified in the link, you should get a 404. If your website is hosted in IIS, you can specify behaviors when you get error messages, like 404s. Maybe IIS is doing something where it redirects a 404 to go to a Default.aspx page?

Also, I just noticed you started off with "from time to time". So that means this is an inconsistent error? The links sometimes work, but sometimes they don't? If that's the case, something is seriously wrong and it may be some sort of bug in Visual Studio, a plug-in, or something else. Reinstall when all else fails!


What does your Authorization node look like in your Web.config? My guess is that the path to your Forgot Password page is requiring an authenticated user.


  • How could I get the link of an specific sheet with Google script?
  • Azure AD B2C Custom Policy
  • Join with Three Tables
  • TFS 2010 work item - Work item links
  • ASP.NET: Setting the Style of an HTML element Programatically
  • How to display formatted HTML data in kendo ui grid column
  • Why isn't page jQuery .focus event changing background-color style to green in Google Chrome af
  • Use a ListProperty or custom tuple property in App Engine?
  • UITableView without still works!
  • purpose of if (true)
  • How to programatically add a hyperlink to a cell in a worksheet using office-js?
  • Xcode 4 - Is there something in Interface Builder like “reveal in canvas”?
  • Angularjs: [$injector:modulerr] Failed to instantiate module ui-router
  • how to insert a new column in a dataset with values if it satisfies a statement
  • SIP Makefile fail (gnuwin and mingw)
  • How to add learning rate to summaries?
  • Why isn't my “Fizz Buzz” test in R working?
  • Python PIL to extract number from image
  • Create a link to a web page that runs a Javascript function on the page
  • CodeIgniter URI Parameter is partially bypassing an “if” statement
  • opencv display image without x server
  • Possible to “watch” both HAML and SASS at the same time?
  • How to specify input and output paths from cmd.exe for a PowerShell script?
  • Simulate click Geckofx vb,net
  • Alternative To body {overflow:scroll;} That Will Prevent Page Jostling/Wriggling?
  • Installing Apache MyFaces 2 on WildFly 8.2.0
  • How do I pass the string value parameter of the selected list item from an auto-populated dropdown l
  • MongoError: Incorrect arguments
  • Setting up SourceTree to merge unity3d scenes with UnityYAMLMerge
  • Jquery UI tool tip close icon
  • Django rest serializer Breaks when data exists
  • Initializer list vs. initialization method
  • Using jQuery closest() method with class selector
  • Array.prototype.includes - not transformed with babel
  • HTML download movie download link
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • How to stop GridView from loading again when I press back button?
  • Authorize attributes not working in MVC 4
  • UserPrincipal.Current returns apppool on IIS