title: Redirect After Login : Web.config
body: <p>In my ASP.NET Web Application, the project structure is shown by the following image:</p>
  
  <p><img src="https://i.stack.imgur.com/6CYrE.png" alt="enter image description here"></p>
  
  <p>The Web.config of the Site has form authentication:</p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
    &lt;forms loginUrl="~/Login.aspx" timeout="2880" /&gt;      
  &lt;/authentication&gt;
  </code></pre>
  
  <p>And the Web.config of the Pages folder has:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
  &lt;system.web&gt;
    &lt;authorization&gt;
      &lt;allow roles="Admin"/&gt;
      &lt;deny users="*"/&gt;
    &lt;/authorization&gt;
  &lt;/system.web&gt;
  </code></pre>
  
  <p></p>
  
  <p>I have an User admin with role Admin. After successful Login I am trying to redirect the user in Home.aspx resides in the Pages folder as:</p>
  
  <pre><code>protected void EMSLogin_Authenticate(object sender, AuthenticateEventArgs e) {
      TextBox UserNameTextBox = EMSLogin.FindControl("UserName") as TextBox;
      TextBox PasswordTextBox = EMSLogin.FindControl("Password") as TextBox;
  
      if (Membership.ValidateUser(UserNameTextBox.Text, PasswordTextBox.Text)) {
      Response.Redirect("~/Pages/Home.aspx");
      }
  }
  </code></pre>
  
  <p>But it is not working. It is again redirecting to the Login page i.e., Login.aspx with the URL: <code>localhost:3695/Login.aspx?ReturnUrl=%2fPages%2fHome.aspx</code>.</p>
  
  <p>How can I achieve this? Any information will be very helpful.</p>
  
  <p>Regards.</p>