Answers for "do a redirect into a view to a controller in Asp.net core"

C#
3

do a redirect into a view to a controller in Asp.net core

//In this exemple i am doing a a login verification
  @{
      @if (SignInManager.IsSignedIn(User))
      {
        //Do a redirect if its loggedIn
        Context.Response.Redirect("~/Account/LogIn?returnUrl=Products");
      }
      else
      {
		//If isn't logged in
        Context.Response.Redirect("~/Identity/Account/Login");
      }
  }
  
//If u just wuant to do a redirect out of a context u dont need to say what's
//current conext
@Response.Redirect("~/Account/LogIn?returnUrl=Products");
Posted by: Guest on October-13-2021

Code answers related to "do a redirect into a view to a controller in Asp.net core"

C# Answers by Framework

Browse Popular Code Answers by Language