In old versions of .Net Core, I could do this to throw an exception:
public class MyParentController : Microsoft.AspNetCore.Mvc.Controller
{
protected virtual GamePlayer CurrentPlayer => Players.GetPlayer(Session) ?? throw MyCustomHttpException(HttpStatusCode.Unauthorized, "Unauthorized");
protected Exception MyCustomHttpException(HttpStatusCode code, String msg) => throw new System.Web.HttpException(code.ToString(), Int32.Parse(msg));
}
But after upgrading my solution to .Net 6, I am getting this error:
The type or namespace name HttpException does not exist in System.Web
Does new .Net not offer anything like this?
Thanks!