Reply to topic
Getting to Medium Trust
ldemarest


Joined: 25 Sep 2009
Posts: 2
Reply with quote
This might be obvious to some, but I tracked down my medium trust issues by adding a TRUST element to web.config and then simply debugging the site and working through the issues as they came up.

<system.web>
<trust level="Medium" />
.
.

Specifically, these were the problems I found:

1. As the great techs at HMS noted, I had a class that implemented the VirtualPathProvider interface. The site didn't actually use it, so I just .excluded it from the compile.

2. I also was fetching the connection string in a way that MEDIUM didn't like. Here is the corrected routine with the old stuff commented out.

Private Function MyGetConnectionString() As String
Dim cst As String
'Dim rootWebConfig As System.Configuration.Configuration
'Dim connstring As System.Configuration.ConnectionStringSettings

'rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/")
'If 0 <= rootWebConfig.ConnectionStrings.ConnectionStrings.Count Then
' connstring = rootWebConfig.ConnectionStrings.ConnectionStrings("SiteConnectionString")
' cst = connstring.ConnectionString
'Else
' cst = ""
'End If

cst = ConfigurationManager.ConnectionStrings("SiteConnectionString").ConnectionString

MyGetConnectionString = cst

End Function

3. Finally, I had a routine that wrote to the App_Code folder -- which I guess is illegal in MEDIUM -- but it was really only needed for development, so I just .excluded it.

----------------

That's it. Hope this is helpful to someone.
SepiaBand


Joined: 07 Oct 2009
Posts: 2
Reply with quote
Thanks ldemarest,

Great information. Setting up Medium Trust locally in my development environment has made it much easier to debug my now non-functioning website.

I was wondering if you or anyone else has been able to find a way around "Accessing Web resources on remote servers"? http://msdn.microsoft.com/en-us/library/ms998341.aspx#paght000020_developingformediumtrust says we can't access external web resources under medium trust. I have a (HMS hosted blog) RSS feed that I am displaying on my .NET website which is now failing under Medium Trust. I am hoping someone might have figured a way to do this on HMS. I was hoping that since the RSS feed is hosted on HMS the IP it would fall into the "allowable" range...but is apparently not the case.

Thanks again for your help!
Sepia
cburns


Joined: 03 Feb 2008
Posts: 11
Location: Newark, DE
Reply with quote
SepiaBand, if you have not done so already, open up a support ticket and supply us the full URI of the RSS Feed. We can whitelist specific addresses so that you can access those resources; by default we do not allow any external access, even within our own network.
SepiaBand


Joined: 07 Oct 2009
Posts: 2
Reply with quote
That worked thanks! After submitting a trouble ticket I can now pull in the original RSS feed. Thanks again.
Getting to Medium Trust
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic