Click here to Skip to main content
15,946,342 members
Home / Discussions / ASP.NET
   

ASP.NET

 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder12-Jul-09 22:39
cofounderChris Maunder12-Jul-09 22:39 
QuestionApi call connection resets Pin
Fred283416-Jul-24 3:56
Fred283416-Jul-24 3:56 
AnswerRe: Api call connection resets Pin
Fred283419-Jul-24 1:14
Fred283419-Jul-24 1:14 
QuestionDo ASP.net MVC5 apps require Full trust on IIS10? Pin
Jean Vallee8-Jul-24 4:40
Jean Vallee8-Jul-24 4:40 
AnswerRe: Do ASP.net MVC5 apps require Full trust on IIS10? Pin
Richard Deeming8-Jul-24 6:52
mveRichard Deeming8-Jul-24 6:52 
QuestionChange Code Access Security Level on Plesk Pin
Jean Vallee3-Jul-24 7:51
Jean Vallee3-Jul-24 7:51 
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:

<?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?
AnswerRe: Change Code Access Security Level on Plesk Pin
Richard Deeming3-Jul-24 21:20
mveRichard Deeming3-Jul-24 21:20 
AnswerRe: Change Code Access Security Level on Plesk Pin
Jean Vallee5-Jul-24 4:55
Jean Vallee5-Jul-24 4:55 
QuestionASP.NET Web Application Deploy on IIS problem : Image / Icon not display Pin
SHAHROL AZMI BIN AMZAT12-Jun-24 16:56
SHAHROL AZMI BIN AMZAT12-Jun-24 16:56 
AnswerRe: ASP.NET Web Application Deploy on IIS problem : Image / Icon not display Pin
Richard Deeming12-Jun-24 21:34
mveRichard Deeming12-Jun-24 21:34 
AnswerRe: ASP.NET Web Application Deploy on IIS problem : Image / Icon not display Pin
Dave Kreskowiak13-Jun-24 3:06
mveDave Kreskowiak13-Jun-24 3:06 
QuestionHow to point an application to a new DB server Pin
Richard Andrew x646-Jun-24 5:05
professionalRichard Andrew x646-Jun-24 5:05 
AnswerRe: How to point an application to a new DB server Pin
Ron Nicholson6-Jun-24 5:15
professionalRon Nicholson6-Jun-24 5:15 
GeneralRe: How to point an application to a new DB server Pin
Richard Andrew x646-Jun-24 5:19
professionalRichard Andrew x646-Jun-24 5:19 
QuestionHow C Programming Principles Shape C# .NET Development Pin
Member 162807866-Jun-24 3:53
Member 162807866-Jun-24 3:53 
AnswerRe: How C Programming Principles Shape C# .NET Development Pin
Dave Kreskowiak6-Jun-24 5:18
mveDave Kreskowiak6-Jun-24 5:18 
Questionassertion failed : unrecognized tag script Pin
Patil Anant9-Mar-24 2:07
Patil Anant9-Mar-24 2:07 
AnswerRe: assertion failed : unrecognized tag script Pin
Richard MacCutchan9-Mar-24 2:30
mveRichard MacCutchan9-Mar-24 2:30 
AnswerRe: assertion failed : unrecognized tag script Pin
Andre Oosthuizen12-Mar-24 6:57
mveAndre Oosthuizen12-Mar-24 6:57 
Questionis it hard to add new module into Umbraco CMS? Pin
Southmountain7-Feb-24 8:23
Southmountain7-Feb-24 8:23 
AnswerRe: is it hard to add new module into Umbraco CMS? Pin
RedDk7-Feb-24 8:43
RedDk7-Feb-24 8:43 
QuestionUI library for ASP.NET Core MVC Razor Pin
Mark Pelf 8-Dec-23 5:18
mvaMark Pelf 8-Dec-23 5:18 
QuestionCoding Help Pin
appache0524-Nov-23 18:04
appache0524-Nov-23 18:04 
AnswerRe: Coding Help Pin
Richard MacCutchan24-Nov-23 22:05
mveRichard MacCutchan24-Nov-23 22:05 
AnswerRe: Coding Help Pin
Andre Oosthuizen25-Nov-23 1:24
mveAndre Oosthuizen25-Nov-23 1:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.