...

Web.Config debugging trust

ghell
10-28-2005, 05:43 PM
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:D )

kampfer
10-28-2005, 10:00 PM
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 (http://samples.gotdotnet.com/quickstart/aspplus/doc/configformat.aspx)more informations.

-john

ghell
10-29-2005, 01:58 PM
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<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

kampfer
10-29-2005, 04:09 PM
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

ghell
10-30-2005, 03:47 PM
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)

ghell
11-07-2005, 10:06 AM
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:<%@ 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:<configuration>
<system.web>
<compilation debug="true" />
</system.web>
</configuration>in the directory, i get this error: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.573how do i fix this?!

kampfer
11-08-2005, 12:56 AM
try putting the following line in the web.config file, in the <system.web>

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

ghell
11-08-2005, 10:58 AM
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:o

kampfer
11-08-2005, 02:15 PM
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 (http://kb.servertastic.com/article.aspx?id=10007&cNode=0S8W8H)

-john

ghell
11-08-2005, 03:00 PM
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:<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 displaysShow Detailed Compiler Output:

Show Complete Compilation Source:

kyra13
08-03-2011, 12:49 PM
I've had some similar problem< but now it's OK, runs like watches
thank you all



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum