replace the start page with another page
Monday, November 25, 2024 4:36:02 PM
Hello,
Which page and line should I write the code below?
I want the first opening start page to be opened as "MainPage" that I created in the default controls
Waiting for your reply, thank you very much
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapRoute(
name: "SomeDescriptiveName",
template: "AnotherNameThatPointsToHome/{action=MainPage}/{id?}",
defaults: new { controller = "Default" }
);
}
0
Hello, where should I write the following redirect code?
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseMvc(Routes =>
{
Routes.MapRoute(
name: "default",
template: "{controller=Default}/{action=MainPage}/{id?}");
});
}
}
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseMvc(Routes =>
{
Routes.MapRoute(
name: "default",
template: "{controller=Default}/{action=MainPage}/{id?}");
});
}
}
0