I am try to build alerts list and added them to TempData
. But it work if I did not do redirect. When I do redirect it give me 500 error. I set break point in vi
Did you configure Session? TempData is using session behind the scenes.
Project.json
"Microsoft.AspNetCore.Session": "1.1.0"
Here is the Startup.cs file. - ConfigureServices
method
public void ConfigureServices(IServiceCollection services)
{
services.AddSession();
services.AddMvc();
}
And Configure
method.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseSession();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
Now try with TempData, it will work.
And you can set the environment with set ASPNETCORE_ENVIRONMENT=Development
environment variable.