title: Redirect user after authentication with OpenIdConnect in ASP.Net MVC
body: <p>I am using OpenIdConnect provider with Owin/Katana for authentication in my asp.net mvc application. OpenIdConnect Provide authenticates users against Active Directory. I wanted to do a simple authorization check once the user is authenticated and redirect the user to another view.</p>
  
  <pre><code>app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions()
          {
              Authority = "url",
              Scope="scopes",
              ResponseType = "response",
              ClientId = "clientid",
              SignInAsAuthenticationType = "Cookies",
              Notifications = new OpenIdConnectAuthenticationNotifications()
              {
                  SecurityTokenValidated = (context) =&gt;
                  {
                      var identity = context.AuthenticationTicket.Identity;
                      var emailClaim = identity.Claims.Where(r =&gt; r.Type == ClaimTypes.Email).FirstOrDefault();
  
                      var user = dbContext.Users.Where(u=&gt;u.Email==emailClaim.Value);
                      if (user != null)
                      {
                          //add user information to claims.
                          identity.AddClaim(new Claim(CustomClaimTypes.PersonId, user.Name.ToString()));
                      }
                      else
                      {
                          //redirect to a page 
                      }
  
                      return Task.FromResult(0);
                  }
               }
          });
  </code></pre>
  
  <p>How can I redirect the user if he is not in my database. </p>