0

I'm working on an ASP.NET application in Visual Studio 2022using NET 6 When i m rendering the script using " @Styles.Render("~/plugins/datetimepickerStyle") like this I am getting error " Reference to type 'IHtmlString' claims it is defined in 'System.Web', but it could not be found also i am not able to system.web dll .

I have tried to many times to build rebuild try to install packages.

Qing Guo
  • 6,041
  • 1
  • 2
  • 10
Jaya acharya
  • 37
  • 1
  • 6
  • what was the exact error message? also, could you double check on the project file that you have `Microsoft.AspNet.Mvc` installed? – Bagus Tesa Jan 20 '23 at 05:45

1 Answers1

1

In .net6 we add css like below:

<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />

You can read this to know more.

Qing Guo
  • 6,041
  • 1
  • 2
  • 10
  • Thanks a lot I have one more question in my project I am unable to add sytem.web reference could please suggest .net6 framework its support or not ?or how can use Session on view @if (Session["LoginUser"] != null) getting error there if using this – Jaya acharya Jan 20 '23 at 08:32
  • @Jayaacharya If you want to use session , I suggest you try:`@HttpContextAccessor.HttpContext.Session.GetString("LoginUser")` , you can refer [this](https://stackoverflow.com/questions/73884640/asp-net-core-document-ready-read-session-value/73889807#73889807) to set session value. – Qing Guo Jan 31 '23 at 07:46