Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

AppTheory specializes in solutions based on the DotNetNuke platform and has 2 employees on the DotNetNuke Core Team.
  Ads  
 


  Sponsors  

Meet Our Sponsors

SmarterTools
Verndale
The Official Microsoft ASP.NET Website
Portal Webhosting - Hosting For Developers
Red-Gate Software
MaximumASP
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Global Variables
Previous Previous
 
Next Next
New Post 3/13/2006 12:55 PM
User is offline Bill Cunnien
44 posts
10th Ranked


Global Variables 

Without recompiling DNN, how do I introduce some custom global variables (like a server path) into the application to be retrieved at run-time?  I have a set of images being stored in a share on our network.  I want DNN to know what that path is to the share and use it to retrieve the images for display within a custom module.  I do not want to hard-code the pathname but rather store it globally.  If the server gets moved, then I just need to go to that one location and change it.  Should I do this in the web.config file?  Like the connection strings to additional databases?  If so, what is the best way to add this kind of thing to the file?

Thanks,
Ling

 
New Post 3/13/2006 1:43 PM
User is offline Tony Valenti
375 posts
8th Ranked


Re: Global Variables 
Well, I'd say that's messy.  I would recommend just storing it in another table or in Module settings, however, if you absolutely can't do that, I'd say store the value in the Web.Config

-Tony Valenti

I work for PowerDNN - The Enterprise DotNetNuke DNN Hosting Provider
Tony.Valenti@PowerDNN.com
+001-402-650-6072
 
New Post 3/13/2006 2:18 PM
User is offline Bryan Johns
58 posts
www.greendragonweb.com
10th Ranked


Re: Global Variables 
Inside web.config, in the appSettings do something like this:

<appSettings>
    <add key="ImagePathKey" value="path to images" />
    <!-- the rest of the appSettings -->
</appSettings>


Then in your custom module do something like this:

Imports System.Configuration.ConfigurationSettings

Private Function ImagePath() as String
    Return AppSettings("ImagePathKey")
End Function


Then simply call the ImagePath function whenever you need to assign the path to your images to some variable.  DNN might have built in function(s) to handle this so you only need to call the DNN function and maybe pass the name of your new appSettings key.  If so perhaps one of the more experienced DNN dev's on this forum might speak up.

Bryan Johns
K4GDW

"There are 10 types of people. Those who understand binary and those who do not."
 
New Post 3/13/2006 2:48 PM
User is offline Bill Cunnien
44 posts
10th Ranked


Re: Global Variables 

I see that two people responded (thanks), but I have yet to see their actual responses.  I guess there is a little bit of lag on the moderation of the forum.  No biggee.

I have approached it this way:

Add AppSetting to web.config called MyAppPath and the value \\Server\Share\.  Then I call this value by ConfigurationSettings.AppSettings("MyAppPath").  This works beautifully.

If someone else has a more elegant and effective way, please let me know.  Perhaps those two responses already have it listed...we shall see...

Ling

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Global Variables
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


AfterImage Internet Consulting and SEO Services
AfterImage provides search engine optimization (SEO), Internet consulting and hosting services for the Windows platform (IIS, ASP, SQL Server).
www.afterimage.nl/
Alki Homes - Seattle, WA
Exemplary service for your Seattle Real Estate needs. It's what you deserve from your Realtor®!
www.alkihomes.com
Swanzey Internet Group LLC
DotNetNuke design, development, e-Commerce, hosting, maintenance, and training. Exclusively DotNetNuke.
www.swanzey.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP