I built a simple 1 page site with Visual Studio 2022 using asp.net. It has a few buttons that display some images and 2 links to a subdomain. No additional modules were used... just published with straight VS.
The host I am using has the CAS trust level default as FULL and it works successfully if I leave it that way.
Now I want to change hosts and the new host does not support a FULL CAS Trust Level, only HIGH.
This is my web.config:
I asked my current host for tech assistance and they did not have an answer but suggested I comment code out of the <system.codedom> section. There is no code to comment out so it's obvious they did not even look at my web.config file.
What do I need to change either in web.config or VS to get it change to a CAS level of HIGH?
The host I am using has the CAS trust level default as FULL and it works successfully if I leave it that way.
Now I want to change hosts and the new host does not support a FULL CAS Trust Level, only HIGH.
This is my web.config:
<?xml version="1.0" encoding="utf-8"?><!-- For more information on how to configure your ASP.NET application, please visit https://go.microsoft.com/fwlink/?LinkId=301880 --><configuration><appSettings><add key="webpages:Version"value="3.0.0.0" /><add key="webpages:Enabled"value="false" /><add key="ClientValidationEnabled"value="true" /><add key="UnobtrusiveJavaScriptEnabled"value="true" /></appSettings><system.web><customErrors mode="Off" /><compilation targetFramework="4.8" tempDirectory="D:\InetPub\vhosts\permitlvonline.com\tmp" /><httpRuntime targetFramework="4.8" /><securityPolicy><trustLevel name="Full" policyFile="internal" /><trustLevel name="High" policyFile="web_hightrust.config" /><trustLevel name="Medium" policyFile="web_mediumtrust.config" /><trustLevel name="Low" policyFile="web_lowtrust.config" /><trustLevel name="Minimal" policyFile="web_minimaltrust.config" /></securityPolicy><trust level="High" /></system.web><runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" /><bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" /></dependentAssembly><dependentAssembly><assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" /><bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" /></dependentAssembly><dependentAssembly><assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" /></dependentAssembly><dependentAssembly><assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" /></dependentAssembly><dependentAssembly><assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /></dependentAssembly><dependentAssembly><assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /></dependentAssembly><dependentAssembly><assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" /></dependentAssembly></assemblyBinding></runtime><system.codedom></system.codedom></configuration><!--ProjectGuid: 341B6D57-1384-4224-8AC6-C7F85BF0A4E3-->
I placed the web_hightrust.config file in the same folder as web.config. This is the error message generated when I set CAS trust level to High. (instead of Full) [SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.] System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0 System.Security.CodeAccessPermission.Demand() +57 System.Web.HttpContext.System.IServiceProvider.GetService(Type service) +79 System.Web.WebPages.UrlRewriterHelper.IsUrlRewriterTurnedOn(HttpContextBase httpContext) +128 System.Web.WebPages.UrlRewriterHelper.WasRequestRewritten(HttpContextBase httpContext) +16 System.Web.WebPages.UrlUtil.GenerateClientUrlInternal(HttpContextBase httpContext, String contentPath) +167 System.Web.WebPages.UrlUtil.GenerateClientUrlInternal(HttpContextBase httpContext, String contentPath) +113 System.Web.WebPages.UrlUtil.GenerateClientUrl(HttpContextBase httpContext, String basePath, String path, Object[] pathParts) +150 ASP._Page_Views_Shared__Layout_cshtml.Execute() +620 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122 System.Web.WebPages.<>c__DisplayClass40_0.<RenderPageCore>b__0(TextWriter writer) +309 System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +18 System.Web.WebPages.WebPageBase.Write(HelperResult result) +108 System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +89 System.Web.WebPages.WebPageBase.PopContext() +310 System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +152 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +378 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +17 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +91 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +795 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +81 System.Web.Mvc.Async.<>c__DisplayClass3_6.<BeginInvokeAction>b__4() +262 System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__1(IAsyncResult asyncResult) +188 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +60 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38 System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +29 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +60 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52 System.Web.Mvc.<>c.<BeginExecute>b__151_2(IAsyncResult asyncResult, Controller controller) +17 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +39 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +60 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +14 System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +43 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +60 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +13 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +431 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +75 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +158 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4718.0
I asked my current host for tech assistance and they did not have an answer but suggested I comment code out of the <system.codedom> section. There is no code to comment out so it's obvious they did not even look at my web.config file.
What do I need to change either in web.config or VS to get it change to a CAS level of HIGH?