title: MVC 3 Access page with allow anonymous
body: <p>i'm create a project using mvc 3 with windows authentication. my case is when in login page i'm create a link to redirect page to page "forgot password".
  but, the problem is. when i'm click a link to access another page without login. in my url browser show the url like this : "<a href="http://localhost:5074/Account/Login?ReturnUrl=%2fForgotPassword" rel="nofollow noreferrer">http://localhost:5074/Account/Login?ReturnUrl=%2fForgotPassword</a>".
  cannot redirect to controller "forgotpassword".</p>
  
  <p>-I've tried some ways like custom web.config, global.asax and others but it did not work</p>
  
  <p>please correct my code and give me the solution.</p>
  
  <p>View -> login.cshtml</p>
  
  <pre><code>&lt;a href="@Url.Action("Index", "ForgotPassword")"&gt;Forgot Password?&lt;/a&gt;
  </code></pre>
  
  <p>Controller -> ForgotPassword</p>
  
  <pre><code>namespace EDIS.Controllers
  {
  public class ForgotPasswordController : MyController
  { 
      public ActionResult Index()
      {
          return View();
      }
  }
  }
  </code></pre>
  
  <p>web.config</p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
    &lt;forms loginUrl="~/Account/Login" timeout="2880" /&gt;
  &lt;/authentication&gt;
  &lt;authorization&gt;
    &lt;deny users="?" /&gt;
  &lt;/authorization&gt;
  </code></pre>
  
  <p>global.asax</p>
  
  <pre><code>public class MvcApplication : System.Web.HttpApplication
  {
      public static void RegisterGlobalFilters(GlobalFilterCollection filters)
      {
          filters.Add(new HandleErrorAttribute()); 
      }
  
      public static void RegisterRoutes(RouteCollection routes)
      {
          routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
          routes.MapRoute(
              "Default", // Route name
              "{controller}/{action}/{id}", // URL with parameters
              new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
          );
      }
  
      protected void Application_Start()
      {
          AreaRegistration.RegisterAllAreas();
          RegisterGlobalFilters(GlobalFilters.Filters);
          RegisterRoutes(RouteTable.Routes);
      }
  
      protected void Application_PreRequestHandlerExecute(object sender, EventArgs e)
      {
          DevExpressHelper.Theme = "DevEx";
      }
  
      protected void Application_PostAuthenticateRequest(object sender, EventArgs e)
      {
          HttpCookie authCookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
          if (authCookie != null)
          {
              string encTicket = authCookie.Value;
              if (!String.IsNullOrEmpty(encTicket))
              {
                  FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(encTicket);
                  CustomIdentity id = new CustomIdentity(ticket);
                  CustomPrincipal principal = new CustomPrincipal(id);
                  HttpContext.Current.User = principal;
              }
          }
      }
  }
  </code></pre>