HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 1.1ASP.Net 1.1Global VariablesGlobal Variables
Previous
 
Next
New Post
3/13/2006 11:55 AM
 

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 12:43 PM
 
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
Tony.Valenti@PowerDNN.com
+001-402-650-6072

PowerDNN.com - World Leader in DotNetNuke Hosting and DNN Hosting
PowerDNN.co.uk - European Leader in DotNetNuke Hosting UK and DNN Hosting UK

PowerGrid - The DotNetNuke Private Cloud is Here!
 
New Post
3/13/2006 1:18 PM
 
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 1:48 PM
 

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
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 1.1ASP.Net 1.1Global VariablesGlobal 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.

Attend A Webinar
Free Demo Site
Download DotNetNuke Professional Edition Trial
Have Someone Contact Me
Have Someone Contact Me

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

DotNetNuke Scoop!

Sponsors

DotNetNuke Corporation

DotNetNuke Corp. is the steward of the DotNetNuke open source project, the most widely adopted Web Content Management Platform for building web sites and web applications on Microsoft. Organizations use DotNetNuke to quickly develop and deploy interactive and dynamic web sites, intranets, extranets and web applications. The DotNetNuke platform is available in a free Community and subscription-based Professional and Enterprise Editions with an Elite Support option. DotNetNuke Corp. also operates the DotNetNuke Store where users purchase third party apps for the platform.