Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts

    Web.Config debugging trust

    i have fixed this problem before but i cant find the file i fixed it to... when i get an error on asp.net it says i dont have the trust level to debug, i know its something to add to the web.config file but i dont know whwere or what.

    also how can i use different web.config files for different virtual directories (atm i have a virtual directory in root and anything in that virtual directory uses the web.config file from root, i believe it can use /public/bin/ for dlls but i havnt tested so maby i havnt set it up properly.. in iis it shows up as a directory /public/ and a virtual directory /public/ both in the root so maby its just loading it up as the directory.. anyway.. trust.. debug .. etc )

  • #2
    New Coder
    Join Date
    Oct 2005
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I believe you need to add:

    <compilation debug="true">

    to the web.config

    yes, you can have a web.config file for each virtual directory. Here's more informations.

    -john

  • #3
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    the file as it is at the moment contains that debug attribute but when i set it to true it makes no difference, here it is
    Code:
    <configuration>
      <configSections>
        <sectionGroup name="SharePoint">
          <section name="SafeControls" type="Microsoft.SharePoint.ApplicationRuntime.SafeControlsConfigurationHandler, Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=..." />
          <section name="RuntimeFilter" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=..." />
          <section name="WebPartLimits" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=..." />
          <section name="WebPartCache" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=..." />
          <section name="WebPartWorkItem" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=..." />
          <section name="WebPartControls" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=..." />
          <section name="SafeMode" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=..." />
          <section name="OnlineLibrary" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=..." />
        </sectionGroup>
      </configSections>
      <SharePoint>
        <SafeMode MaxControls="50" CallStack="false" />
        <WebPartLimits MaxZoneParts="50" PropertySize="1048576" />
        <WebPartCache Storage="CacheObject" />
        <WebPartWorkItem Timeout="7000" />
        <WebPartControls DatasheetControlGuid="65BCBEE4-7728-41a0-97BE-14E1CAE36AAE" />
        <!--
    SafeControl Attributes:
              Assembly="[Assembly]" - The .NET assembly in which the control is contained. This attribute can also contain version, culture, and public key token information.
              Namespace="[Namespace]" - The .NET namespace in which the control is defined.                                         
              TypeName="[Typename]" - The .NET class name of the control. You can type an asterisk (*) wildcard character to indicate all TypeNames in a Namespace. 
              Safe="[True|False]" - Specifies whether a Web Part or Web Form Control is safe and can be displayed on a Web Parts Page. This attribute is True by default.
    -->
        <SafeControls>
          <SafeControl Assembly="System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=.." Namespace="System.Web.UI.WebControls" TypeName="*" Safe="True" />
          <SafeControl Assembly="System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=..." Namespace="System.Web.UI.HtmlControls" TypeName="*" Safe="True" />
          <SafeControl Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=..." Namespace="Microsoft.SharePoint" TypeName="*" Safe="True" />
          <SafeControl Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=..." Namespace="Microsoft.SharePoint.WebPartPages" TypeName="*" Safe="True" />
          <SafeControl Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=..." Namespace="Microsoft.SharePoint.WebControls" TypeName="*" Safe="True" />
          <SafeControl Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=..." Namespace="Microsoft.SharePoint.ApplicationPages" TypeName="*" Safe="True" />
          <SafeControl Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=...." Namespace="Microsoft.SharePoint.SoapServer" TypeName="*" Safe="True" />
          <SafeControl Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=...." Namespace="Microsoft.SharePoint.Meetings" TypeName="*" Safe="True" />
        </SafeControls>
        <OnlineLibrary Url="http://r.office.microsoft.com/r/hlidAwsGallery" />
      </SharePoint>
      <system.web>
        <securityPolicy>
          <trustLevel name="WSS_Medium" policyFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\config\wss_mediumtrust.config" />
          <trustLevel name="WSS_Minimal" policyFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\config\wss_minimaltrust.config" />
        </securityPolicy>
        <httpHandlers>
          <add verb="*" path="/_vti_bin/*.aspx" type="System.Web.UI.PageHandlerFactory, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=...." />
          <add verb="*" path="*.aspx" type="Microsoft.SharePoint.ApplicationRuntime.SharePointHandlerFactory, Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=....." />
        </httpHandlers>
        <customErrors mode="Off" />
        <httpRuntime maxRequestLength="51200" />
        <authentication mode="Windows" />
        <authorization>
          <allow users="*" />
        </authorization>
        <identity impersonate="true" />
        <httpModules>
          <clear />
          <add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
          <add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />
          <!--	<add name="Session" type="System.Web.SessionState.SessionStateModule"/>-->
        </httpModules>
        <globalization fileEncoding="utf-8" />
        <compilation batch="false" debug="true" />
        <pages enableSessionState="false" enableViewState="true" enableViewStateMac="true" validateRequest="false" />
        <trust level="WSS_Minimal" originUrl="" />
        <machineKey validationKey="..." decryptionKey="...." validation="SHA1" />
      </system.web>
    </configuration>
    EDIT: hilighting debug line and pointing out when its true it makes no difference
    Last edited by ghell; 10-30-2005 at 03:50 PM.

  • #4
    New Coder
    Join Date
    Oct 2005
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i can't find where you added
    <compilation debug="true" />


    you need to add this line of code for debugging to work.

    p.s. do you have the web.config file in your root directory? Make sure it's not in a folder in the root directory. Also you may have to contact your Web Host and ask them where to place the Web.Config file.
    -john

  • #5
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    it is in the root directory and when i rename it the file stops with the error (obv i want the error so i just renamed it for a sec to see if it was runing that file and it was) there is a compilation debug in there that is false, i said at the top that when i set it to true it makes no difference, i also asked where i can add that line if i need it in another place (eg if there is a compilation debug but its in the wrong section of the file)

  • #6
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    ok since im not getting any replies i will make the question simpler

    my aspx file is the only file on the server. it looks like this:
    Code:
    <%@ Page Language = "VB" %>
    <%
    Response.Write("Hello, World!")
    %>
    the directory it is in is a virtual directory and the web.config i put in it is definately used as when i put this:
    Code:
    <configuration>
      <system.web>
        <compilation debug="true" />
      </system.web>
    </configuration>
    in the directory, i get this error:
    Code:
    Server Error in '/' Application.
    Debugging is not supported under current trust level settings.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    
    Exception Details: System.Web.HttpException: Debugging is not supported under current trust level settings.
    
    Source Error:
    
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    
    Stack Trace:
    
    [HttpException (0x80004005): Debugging is not supported under current trust level settings.]
       System.Web.UI.TemplateParser.HandlePostParse() +183
       System.Web.UI.TemplateControlParser.HandlePostParse() +12
       System.Web.UI.TemplateParser.Parse() +200
       System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation() +74
       System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean fCreateIfNotFound) +189
       System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath() +125
       System.Web.UI.TemplateParser.GetParserCacheItem() +87
       System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String virtualPath, String inputFile, HttpContext context) +120
       System.Web.UI.TemplateControlParser.GetCompiledInstance(String virtualPath, String inputFile, HttpContext context) +36
       System.Web.UI.PageParser.GetCompiledPageInstanceInternal(String virtualPath, String inputFile, HttpContext context) +43
       System.Web.UI.PageParser.GetCompiledPageInstance(String virtualPath, String inputFile, HttpContext context) +249
       Microsoft.SharePoint.ApplicationRuntime.SharePointHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
       System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, String path, String pathTranslated, Boolean useAppConfig) +698
       System.Web.MapHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +96
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +173
    
    
    Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
    how do i fix this?!
    Last edited by ghell; 11-07-2005 at 10:09 AM.

  • #7
    New Coder
    Join Date
    Oct 2005
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try putting the following line in the web.config file, in the <system.web>

    <trust level="Full" originUrl="" />

  • #8
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    that worked great! thanks!

    however, it seems that when i have this line in, the <compilation debug="true" /> or Debug="true" (at the top of the page) make no difference, i can set them both to false and as long as i have full trust it always shows debug lines, is there a different trust level that allows debugging only if its set to true somewhere else (same web.config, web.config in a lower virtual directory or page attribute) ?

    i cant find any documentation on this at all sorry
    Last edited by ghell; 11-08-2005 at 11:02 AM.

  • #9
    New Coder
    Join Date
    Oct 2005
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Trust Level
    Full - Unrestricted permissions. Applications can access any resource that is subject to operating system security. All privileged operations are supported.

    High - Not able to call unmanaged code
    Not able to call serviced components
    Not able to write to the event log
    Not able to access Microsoft Message Queuing queues
    Not able to access OLE DB data sources

    Medium - In addition to the above, file access is restricted to the current application directory and registry access is not permitted.

    Low - In addition to the above, the application is not able to connect to SQL Server and code cannot call CodeAccessPermission.Assert (no assertion security permission).

    Minimal - Only the execute permission is available.

    original source

    -john

  • #10
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    thanks for that (although the database connectivity parts contradict my code.. i can connect to mssql via oledb even on minimal.. maby my security policy files are just broken somewhere.. i dont even know where they are located)

    do you know how i would go about setting it up so that the section of the debug that hilights the line and describes the error shows up but not the whole source and compiler logs. i dont work on that site from localhost so i cant set customErrors to remoteonly for friendly errors or i wont see them myself.. i dont want to let everyone see the source every time an error comes up

    my current web.config file:
    Code:
    <configuration>
      <system.web>
        <compilation debug="true" />
        <trust level="Medium" />
        
        <customErrors mode="Off" />
      </system.web>
    </configuration>
    at the moment i just want to hide the part that displays
    Show Detailed Compiler Output:

    Show Complete Compilation Source:
    Last edited by ghell; 11-08-2005 at 03:50 PM.

  • #11
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've had some similar problem< but now it's OK, runs like watches
    thank you all


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •