NOOB...HELP!!! Trying to read a connection string from web.config. I have a simple page with a text-box and button. On Click, the button runs code to retrieve the connection string from web.config. The app works fine locally. For reference, I used the VB example from MSDN:
http://msdn.microsoft.com/en-us/library/ms178411(VS.80).aspxI've uploaded web.config and Default.aspx to the root directory of my site...and the dll to a bin folder that I created in the root. The page displays fine. However, when I click the button, the followig line fails:
CODE
rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("")
The error is:
CODE
Request for the permission of type 'System.Security.Permissions.RegistryPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Note: For giggles, I added a <trust>...</trust> tag to my web.config as follows and now I can duplicate the error locally:
CODE
<trust
level="Medium"
originUrl=""
processRequestInApplicationTrust="true"
/>
To be honest, I'm not really following what any of this means. I think understand the general idea of
trust, but I can't say I understand what is really happening. If I were to guess, I'd say that the line of code above requires FULL TRUST, so running the app with anything less causes the line to fail. But if that were true, then that would mean that web apps can't read connection strings from web.config unless your app runs in full trust...and that doesn't sound right.
Any adivce?