Hi @Volk Volk,
Here is a whole working demo you could follow:
1.Test.cshtml.cs in Areas\Identity\Pages
public class TestModel : PageModel
{
public async Task<IActionResult> OnGet()
{
return RedirectToAction("Index","Sales", new { area = "Customer",info = 1234 }); ;
}
}
2.Index.cshtml in Areas\Customer\Views\Sales
and SalesController in Areas\Customer\Controllers
[Area("Customer")]
public class SalesController : Controller
{
public IActionResult Index(int info)
{
return View();
}
}
3.Program.cs:
var builder = WebApplication.CreateBuilder(args);
// Add services to the container...
builder.Services.AddControllersWithViews();
builder.Services.AddRazorPages();
var app = builder.Build();
//other middleware....
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllerRoute(
name: "MyArea",
pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
app.MapRazorPages();
app.Run();
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Rena