Asp.net core TempData give 500 error when adding list and redirect to another view

后端 未结 3 1036
清歌不尽
清歌不尽 2020-12-31 08:40

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

3条回答
  •  青春惊慌失措
    2020-12-31 09:09

    This is what I use to enable Session and Temp data on Core Runtime 2.0.6.

    ConfigureServices Section of Startup

    // Add MVC service.
    services.AddMvc(config =>
    {
        // Configure global usage of antiforgery tokens.
        config.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());
    })
    .AddSessionStateTempDataProvider();
    
    // Adds the ability to use session variables.
    services.AddSession(options =>
    {
        options.Cookie.HttpOnly = true;
    });
    

提交回复
热议问题