How to reference own web config setting from custom module?


If I add a connectionstring to a non-DNN database in the dotnetnuke web.config
like so:
<add key="connectionString" value="Server=localhost;initial catalog=DNN_PAsFromVideo; Trusted_Connection=Yes" />
<add key="strconnstrSP" value="server=DevServer;initial catalog=unrelatedDatabase; Trusted_Connection=Yes" />

How can I reference this from a custom module?
In Components/Global.vb there is the following function
Public Function GetDBConnectionString() As String
Return ConfigurationSettings.AppSettings("connectionString")
End Function
but I don't want to have to modify the core by adding similar function for my own module. I'll be re-using this connectionstring in a number of custom modules for my company, so I don't want to make it a property for the individual module either.
11/6/2004 4:58:44 PM 4559 articles. 0 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 3


You can just use System.Configuration.ConfigurationSettings.AppSettings("strconnstrSP") to get what you want.

Richard Edwards

DNNStuff Admin

Home of Aggregator (Tabbed Modules) and free module SQLView
11/6/2004 10:02:44 PM
Ah ... I had just tried to use ConfigurationSettings.AppSettings("strconnstrSP") as I do in my ordinary .net apps with no success. This does the trick, thanks!
11/6/2004 10:19:27 PM
Yeah, if you want to use ConfigurationSettings.AppSettings("strconnstrSP") you would need to Import System.Configuration first.

Richard Edwards

DNNStuff Admin

Home of Aggregator (Tabbed Modules) and free module SQLView
11/7/2004 12:48:59 AM

Similar Artilces:

Where to place custom HTTP Module and reference separate web.config app files
My boss wants to instead implement a custom HTTP Module so that we can move each individual check into each applications own web.config and each app's webconfig somehow wires up together as one...I don't know what he means..  So instead of doing this in the wwwroot web.config:       <urlrewrites>            <rule>                 <url>\/recipes\/\d+\/detail.aspx</url>        &...

Has anyone created a custom module that had a set of global settings for all instances of that module type?
I am in the process of attempting to convert some asp pages on my intranet to DNN modules Let me start with a brief overview of my understanding of modules to make sure I am on the right track. Each instance of a module has the ability to configure its own settings and each module instance has its own data. The definition of a module is stored in the module definitions table, when a module is added to a tab a record is inserted into the modules table and any settings are added into the modulesettings table. what is the best way to create a module that will never have its own ...

Custom module / error handeling in module settings
I am working on a custom module, and I need to do some server side validation in the settings page/control of the module, and if the validation fails I need to show the user an error message. I tried to use the DotNetNuke.UI.Skins.Skin.AddModuleMessage in the UpdateSettings() method, but the messages does not show up, in fact DNN sends me back to the view page. I have also tried to use the AddPageMessage, but with the same result. In the view part of the module the AddModuleMessage is working fine and showing messages on the top of the pane. Any help is greatly appreciated. ...

Customize RSS Module? or a custom module?
I would like for example that the rss module extracts info from different rss feeds on my page. but in a customized way For example the last article, the last new, the last event. To avoid upgrade issues consider creating a custom module. mm I havent realy checked th rss module but isnt the features you want replicated by a custom xsl file. Or you could check out the other rss modules that are out there RSSExtra It is possible in xsl to extract info from different xml <xsl:value-of select="document('')/channel/tit...

sub modules, loading custom modules into a parent module
GreetingsI am creating a support system module which will require the ability to add sub modules. For example, there is an admininstrators section in which suport requests are administered, anwsered, solved etc.There is to be another function in the admin section of the support module in which admins can upload a new support form template module, ie, say an admin wants to set up a form for users to lodge a request for new hardware, the form will display all required fields, graphics, validation etc for that request. Another support form template might be to have a new user set up on the acti...

modules, modules
This site appears to be the most comprehensive list of free custom modules: Any other sites? I do like how Rainbow gives you a bucket of them - saves a lot of time over having to snoop around and find some of the DNN ones. Is there also a way to list modules as "certified"? Also - is there a decent repository of skins? I have recently installed version 2.0. Sure wish there were more modules ready for it! That would make it much easier to evaluate the program and give recommendations to my boss. The reason there aren't more 2.0 modules yet is becasue it h...

Module in Module
Hi, Is there a way to place a module inside another module (e.g. A feedback module inside a Text/HTML module) ? Cheers Tassos There is a way to inject controls into a module dynamically based on some criteria like a querystring parameter - is that what you are wanting to do?Dylan Barberread my stupid blog There's a commercial module "wrapper" on Snowcovered that is designed to hold other modules.  So it is possible.I don't know if you could put a module holding a module inside a module containing a module, but I wouldn't try.  The entire space-time...

Optimized VS.Net Solution for custom modules + free modules
I like to leave the DNN core code untouched when I do my module development. Also, I like to work with a clean VS.Net solution which has my custom modules and none of the core projects. After playing around with it for some time, I have created a VS.Net Solution that allows me to do exactly that and I would like to share it with anyone interested. It's called "My Modules" and can be used to develop/debug DNN modules without requiring any core project references. I have blogged about my solution in detail and also posted it for download. In the download package, I have also inclu...

Problems with Web Reference, Settings.Settings file and Web.Config
Hi all!I have added a Web Service to my application and noticed it added a Settings.Setting file with the url to my Web Service. My question is how to change this value after i compiled the project and are on my web server. As far as i can see the Settinsg file is compiled and is "inside the dll" .. Can't i make the URL for the webservice to be added to the Web.Config instead of the Settings file? Or is there any other solution here that i have missed, im not so familiar with the Settings file .. Br, Ola I actually solved it myself. My Web.Config was missing the section <sectionGrou...

Integrating a custom module or any module into .net nuke with vis. dev. express
Ok I am using .net nuke and visual web developer 2005 express edition.  I am new to both. My problem is this...dotnetnuke is installed and working great and I have made changes and used the default modules for various pages on my new site.  However, now I have reached the stage where I need a module template where I can use to write my own code to manipulate data. I cannot for the life of me, figure out how to incorporate a new module into the site.  I copied a module folder that I downloaded called createmoduletemplate into my DesktopModules directory.&nbs...

getting info from custom web.config for module
Greetings all, I've been working on modifying an existing custom module that we've written to make it more flexible during deployment and am having some issues with the vagaries of inheritance of config files through the application folder tree. I have created a custom web.config file in my DNN module folder under desktop modules that contains custom configuration information for the module so that we do not have to modify DNN root web.config when rolling the module out.  During page load, I request information from a custom section in the DNN module web.config via the NameValueSectio...

Going from one Custom Module to Another Customer Module
I am having trouble going from one module to another module. My source module contains a calendar user control (Brainjar's better calendar).  In the day_render event of the calendar control, I add a label to each day and set the text property to an href tag: <a title="Drinks with John" href="http://localhost/DotNetNuke/TestPage/PrototypingEventListing/tabid/54/Default.aspx?itemID=54&status=calEvent">John </a> I am trying to leave the module with the calendar to go to another module's view control.  This link takes me to the view control of the new mod...

Converting an Ibuyspy custom Module to DotNetDuke Custom Module
Are there any instructions on what it takes to convert an IBuySpy Custom Module to DotNetDuke. .. What do I need to add or change. There is a developer whitepaper included with the DNN download I think or you can download the whitepaper at JeremyJeremy WhiteWebstone, LLCMy DNN Blog...

When to use Static Page Module, HTML Page Module, and Custom Module
I'm trying to figure out the pros and cons of using Static pages, the HTML Page Module, and the Custom Module.  Background:  I'm using the CSK to make an old HTML web site easier to maintain.  I have a bunch of old Photo Galleries (yes, several of them containting hundreds of images) that would take many days to convert to using the Photo Gallery module, so I'm researching ways to convert the old pages that isn't so painful.  I don't care if the new photo galleries (which will use the Photo Gallery module) match the look of the old ones, so converting the core HTML on t...

Web resources about - How to reference own web config setting from custom module? -

European Terrestrial Reference System 1989 - Wikipedia, the free encyclopedia
The European Terrestrial Reference System 1989 ( ETRS89 ) is a ECEF (Earth-Centered, Earth-Fixed) geodetic Cartesian reference frame , in which ...

Microsoft dismisses iPad Pro as “a companion device” and references old Steve Jobs stylus quote
... to be a companion device.” Laycock also said that “at one point in time, Apple declared that if there’s a stylus, that’s failure” – a reference ...

Shane Smith Also Dropped a David Carr Reference
On The Drudge Report and elsewhere, much is being made today about the fact that Shane Smith drops 52 F-bombs in this week’s Hollywood Reporter ...

Can you spot these classic film references hidden in Pixar movies?
The animators at Pixar definitely love to throw in allusions to some of their favorite movies in their own films. Vimeo user Jorge Luengo Ruiz ...

10 hidden references to classic films in your favorite Pixar movies
... Madrid, told BuzzFeed that he noticed a ton of allusions in "Toy Story 3" and was inspired to make a video highlighting the cinematic references ...

See The Classic Movie References Found In Pixar's Greatest Films
... all well aware of just how clever Pixar movies are. These emotionally engaging stories are full of intricate themes and crammed with references ...

Worst passwords of 2015: Star Wars references sneak onto list
Enough with "123456" already! SplashData's annual list of the worst passwords in use includes some old favorites and some new sci-fi-inspired ...

Zootopia Trailer Adds a Godfather Reference to Disney Film - Collider
Watch a new trailer for the Disney animated movie Zootopia, which takes place in a world inhabited by talking animals and features Jason Bateman ...

Disney Inundates General Hospital Episode With References To New Year's Eve College Football Playoff ...
ESPN says it isn’t worried about viewership for tomorrow’s college football playoff games on New Year’s Eve , but the degree to which TV viewers ...

Ricky Gervais Defends His Golden Globes Joke About Caitlyn Jenner With a Bill Cosby Reference
Ricky Gervais Defends His Golden Globes Joke About Caitlyn Jenner With a Bill Cosby Reference

Resources last updated: 2/5/2016 3:45:22 AM