简体   繁体   中英

ASP.NET Page redirection without MVC

I'm trying to create a web app where the user logs in, and then is redirected to another page, so everything is done in my code-behind. I'm really new to as.net core, and even after having red a lot about this, I still can't figure out how to do this.

Sorry for this question, i'm pretty sure the answer is quite simple Thanks !

Response.Redirect("/Folder/SubFolder/Page") has been around ever since classic ASP/VBScript, so I had a wild guess it would still work today. Turns out I was right.

Assuming you have a POST to accept the login request, and this returns a Task<IActionResult> , then just return Redirect(url) .

If you create a new ASP.Net Core app with authentication etc. via the new project wizard, it has all the code there in the AccountController that it creates for you...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM