title: default login url on HttpUnauthorizedResult in asp.net mvc
body: <p>I have written a custom <code>AuthorizeAttribute</code> which has the following condition in asp.net mvc3 application:</p>
  
  <pre><code>public override void OnAuthorization(AuthorizationContext filterContext)
  {     
      //auth failed, redirect to Sign In
      if (!filterContext.HttpContext.User.Identity.IsAuthenticated)
      {
         filterContext.Result = new HttpUnauthorizedResult();
      }
  }
  </code></pre>
  
  <p>And in my web.config, i have:</p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
    &lt;forms loginUrl="~/User/SignIn" timeout="2880" /&gt;
  &lt;/authentication&gt;
  </code></pre>
  
  <p>On authentication fail, it redirects to "/Account/Login" page by default.</p>
  
  <p>How do i change this default redirect url and redirect it to "/User/SignIn"?</p>
  
  <p>The screenshot shows the clear view of what i am trying to say..<img src="https://i.stack.imgur.com/nqOCT.png" alt="HttpUnauthorizedresult image"></p>
  
  <p>Though i have set '/User/SignIn', it redirects to '/Account/Login'</p>