<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Getting Started</title><link>http://forums.asp.net/15.aspx</link><description>The perfect forum for ASP.NET novices. No question too simple! &lt;A href="http://aspadvice.com/SignUp/list.aspx?l=21&amp;amp;c=17" target=_blank&gt;Email List&lt;/A&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: best way to store globally accessible values?</title><link>http://forums.asp.net/thread/3275616.aspx</link><pubDate>Sun, 05 Jul 2009 20:28:14 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3275616</guid><dc:creator>dotnetnoob</dc:creator><author>dotnetnoob</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3275616.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=3275616</wfw:commentRss><description>&lt;p&gt;Thanks everyone for the help...I have a much better understanding of the options now and appreciate everyone&amp;#39;s input.&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: best way to store globally accessible values?</title><link>http://forums.asp.net/thread/3275111.aspx</link><pubDate>Sun, 05 Jul 2009 05:07:15 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3275111</guid><dc:creator>hs_jha</dc:creator><author>hs_jha</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3275111.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=3275111</wfw:commentRss><description>&lt;p&gt;Using appSettings section of the web.config file to store persistant data is a good option.&lt;/p&gt;&lt;p&gt;As web.config is an xml file it does not put much pressure on server resources unlike database or application object.&lt;/p&gt;&lt;p&gt;But as far as maintainability is concerned saving in database has an edge as it is not always true that a web administrator is a programmer as well.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: best way to store globally accessible values?</title><link>http://forums.asp.net/thread/3275043.aspx</link><pubDate>Sun, 05 Jul 2009 01:46:12 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3275043</guid><dc:creator>Scott927</dc:creator><author>Scott927</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3275043.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=3275043</wfw:commentRss><description>&lt;p&gt;Personally, I use the appSettings section of the web.config file a lot more than I use application variables. If you&amp;#39;re just starting out with .NET development, I&amp;#39;d say use appSettings for relatively static values (i.e. an SMTP server for sending email, or a path to a particular directory for uploading files, etc...things that you probably won&amp;#39;t change). If you anticipate the values changing a lot (or even a little) during runtime, it would be easier to set initial values in an application variable in global.asax and modify it whenever you need to.&lt;/p&gt;&lt;p&gt;Having said that, you CAN programatically change the appSettings section of web.config, and could even write a wrapper class to abstract some of the relative complexities of doing it (it&amp;#39;s not that hard and probably only a few lines of code), but typing: Application[&amp;quot;VariableName&amp;quot;] = &amp;quot;Something else&amp;quot; is just easier when you&amp;#39;re learning. To get started, I&amp;#39;d probably just do as I outlined above and as you get a little more familiar with .NET, you can branch out into a more in depth solution.&lt;/p&gt;&lt;p&gt;In case you&amp;#39;re curious as to what it would look like to update an appSetting value programmatically, take a look at this:&lt;/p&gt;&lt;p&gt;&lt;pre name="code" class="c-sharp"&gt;public void Update(string key, string value) 
{
Configuration configuration =   WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath); 
AppSettingsSection appSettingsSection = 
  (AppSettingsSection)configuration.GetSection(&amp;quot;appSettings&amp;quot;); 
   if (appSettingsSection != null) 
   {
       appSettingsSection.Settings[key].Value = value; 
       config.Save();
   }
}&lt;/pre&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: best way to store globally accessible values?</title><link>http://forums.asp.net/thread/3275033.aspx</link><pubDate>Sun, 05 Jul 2009 01:10:47 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3275033</guid><dc:creator>malcolms</dc:creator><author>malcolms</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3275033.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=3275033</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://forums.asp.net/members/Scott927.aspx"&gt;Scott927&lt;/a&gt; is right.&amp;nbsp; Store them in your appSettings seeing as though they&amp;#39;re not user specific.&amp;nbsp; Then use the ConfigurationManager to retrieve them:&lt;/p&gt;&lt;p&gt;string something = ConfigurationManager.AppSettings[&amp;quot;YourSetting&amp;quot;];&lt;/p&gt;&lt;p&gt;You&amp;#39;ll need to add a reference to System.Configuration for that to work.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: best way to store globally accessible values?</title><link>http://forums.asp.net/thread/3274906.aspx</link><pubDate>Sat, 04 Jul 2009 18:48:32 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274906</guid><dc:creator>dotnetnoob</dc:creator><author>dotnetnoob</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274906.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=3274906</wfw:commentRss><description>&lt;p&gt;&lt;em&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;Scott927:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;
&lt;p&gt;Application variables and the &amp;lt;appSettings&amp;gt; section of web.config are both valid places to store globally accessible values. I&amp;#39;m not sure I understand where your confusion is coming from. You&amp;#39;d just set the application variables (or create them in &amp;lt;appSettings&amp;gt;) and then call them in your code when you need to.&lt;br /&gt;&lt;/p&gt;&lt;/em&gt;
&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Thanks Scott: My confusion stems from reading many contradictory statements on the &amp;#39;net about whether or not it&amp;#39;s &amp;quot;good&amp;quot; to use Application variables vs. other methods, such as cache or appsettings or classes...I have a tendency to find one way to do something without considering whether it&amp;#39;s a good or bad coding practice (and also trying to apply legacy vbscript coding to .net), so I&amp;#39;m trying to figure out what the best practice is.&lt;/em&gt;&lt;/p&gt;</description></item><item><title>Re: best way to store globally accessible values?</title><link>http://forums.asp.net/thread/3274902.aspx</link><pubDate>Sat, 04 Jul 2009 18:44:23 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274902</guid><dc:creator>srinivaskotra</dc:creator><author>srinivaskotra</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274902.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=3274902</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi,&lt;/p&gt;
&lt;p&gt;if your values a static across the application you can set in web.config file. in &amp;lt;appsettings&amp;gt;&lt;/p&gt;
&lt;p&gt;ex:&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;span&gt;
&lt;p&gt;&amp;lt;appSettings&amp;gt;&lt;/p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;span&gt;
&lt;p&gt;&amp;lt;add key=&amp;quot;Email&amp;quot; value=&amp;quot;classified@lee.com&amp;quot;/&amp;gt;&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;
&lt;p&gt;&amp;lt;/appSettings&amp;gt;&lt;/p&gt;
&lt;p&gt;or the values will chages in runtime you can use sessions or public class with get and set methods&lt;/p&gt;
&lt;p&gt;Thanks :)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/font&gt;</description></item><item><title>Re: best way to store globally accessible values?</title><link>http://forums.asp.net/thread/3274894.aspx</link><pubDate>Sat, 04 Jul 2009 18:33:33 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274894</guid><dc:creator>Scott927</dc:creator><author>Scott927</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274894.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=3274894</wfw:commentRss><description>&lt;p&gt;Application variables and the &amp;lt;appSettings&amp;gt; section of web.config are both valid places to store globally accessible values. I&amp;#39;m not sure I understand where your confusion is coming from. You&amp;#39;d just set the application variables (or create them in &amp;lt;appSettings&amp;gt;) and then call them in your code when you need to.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: best way to store globally accessible values?</title><link>http://forums.asp.net/thread/3274891.aspx</link><pubDate>Sat, 04 Jul 2009 18:30:27 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274891</guid><dc:creator>dotnetnoob</dc:creator><author>dotnetnoob</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274891.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=3274891</wfw:commentRss><description>&lt;p&gt;&lt;em&gt;Thanks...I don&amp;#39;t really understand your code though...I&amp;#39;m not sure how&amp;nbsp;it would be used to store persistent values that can be accessed from any page?&lt;/em&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: best way to store globally accessible values?</title><link>http://forums.asp.net/thread/3274890.aspx</link><pubDate>Sat, 04 Jul 2009 18:29:14 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274890</guid><dc:creator>Scott927</dc:creator><author>Scott927</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274890.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=3274890</wfw:commentRss><description>&lt;p&gt;In global.asax:&lt;/p&gt;&lt;p&gt;&lt;pre name="code" class="c-sharp"&gt;public void Application_Start(object sender, EventArgs e)
{
     Application[&amp;quot;VariableName&amp;quot;] = &amp;quot;Your Value&amp;quot;;
}&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; In your code-behind, you would call it like this:&lt;/p&gt;&lt;p&gt;Response.Write(Application[&amp;quot;VariableName&amp;quot;].ToString());&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Or, you could store them in web.config:&lt;/p&gt;&lt;p&gt;&lt;pre name="code" class="xhtml"&gt;&amp;lt;configuration&amp;gt;
     &amp;lt;appSettings&amp;gt;
          &amp;lt;add key=&amp;quot;VariableName&amp;quot; value=&amp;quot;Your Value&amp;quot; /&amp;gt;
     &amp;lt;/appSettings&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;&lt;br /&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;And access it in your code-behind like this:&lt;/p&gt;&lt;p&gt;Response.Write(System.Configuration.ConfigurationManager.AppSettings[&amp;quot;Variablename&amp;quot;].ToString());&lt;/p&gt;&lt;p&gt;Of course, you could import System.Configuration and just call:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Response.Write(ConfigurationManager.AppSettings[&amp;quot;Variablename&amp;quot;].ToString());&lt;/p&gt;</description></item><item><title>Re: best way to store globally accessible values?</title><link>http://forums.asp.net/thread/3274882.aspx</link><pubDate>Sat, 04 Jul 2009 18:24:29 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274882</guid><dc:creator>srinivaskotra</dc:creator><author>srinivaskotra</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274882.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=3274882</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi,&lt;/p&gt;
&lt;p&gt;You can maintain in session. As per my understanding you want to store a set of values. So &amp;nbsp;you can crate a class file with &amp;nbsp;get set methods.&lt;/p&gt;
&lt;p&gt;public abstract class BaseParameterPasser&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;private string url = string.Empty;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;public BaseParameterPasser()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;if (HttpContext.Current != null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;url = HttpContext.Current.Request.Url.ToString();&lt;br /&gt;&amp;nbsp;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;public BaseParameterPasser(string Url)&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;this.url = Url;&lt;br /&gt;&amp;nbsp;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;public virtual void PassParameters()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;if (HttpContext.Current != null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;HttpContext.Current.Response.Redirect(Url);&lt;br /&gt;&amp;nbsp;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;public string Url&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;get&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return url;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;set&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;url = value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;public abstract string this[string name]&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;get;&lt;br /&gt;&amp;nbsp;&amp;nbsp;set;&lt;br /&gt;&amp;nbsp;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;public abstract ICollection Keys&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;get;&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;Thanks :)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: best way to store globally accessible values?</title><link>http://forums.asp.net/thread/3274874.aspx</link><pubDate>Sat, 04 Jul 2009 18:08:42 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274874</guid><dc:creator>dotnetnoob</dc:creator><author>dotnetnoob</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274874.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=3274874</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;hminaya:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;if they are user specific, then store them in&amp;nbsp; session variables 
&lt;li&gt;if they are NOT user specific, then store them in application variables&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for the quick reply...they would not be user specific...so do you suggest using global.asax, or is there a different way like storing them in appSettings? I&amp;#39;ve seen both but I&amp;#39;m not sure which is better?&lt;/p&gt;
&lt;p&gt;Additionally, I might want to be able to change these settings from an admin page. In the past, I would lock the application, refresh the settings, and then unlock it...is this still appropriate?&lt;/p&gt;</description></item><item><title>Re: best way to store globally accessible values?</title><link>http://forums.asp.net/thread/3274852.aspx</link><pubDate>Sat, 04 Jul 2009 17:18:33 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274852</guid><dc:creator>hminaya</dc:creator><author>hminaya</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274852.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=3274852</wfw:commentRss><description>&lt;ul&gt;&lt;li&gt;if they are user specific, then store them in&amp;nbsp; session variables&lt;/li&gt;&lt;li&gt;if they are NOT user specific, then store them in application variables&lt;/li&gt;&lt;/ul&gt;</description></item><item><title>best way to store globally accessible values?</title><link>http://forums.asp.net/thread/3274810.aspx</link><pubDate>Sat, 04 Jul 2009 16:20:39 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274810</guid><dc:creator>dotnetnoob</dc:creator><author>dotnetnoob</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274810.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=3274810</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi All: If I have values that I want to be able to call anywhere in my website, what is the best way to achieve this? For example if I have a common set of HTML color values that I want to be able to use on any page?&lt;/p&gt;
&lt;p&gt;In classic ASP I would either put them in an include file or maybe in the global file, but what is the best way to do this in vb.net?&lt;/p&gt;</description></item></channel></rss>