Ask a Question related to ASP.NET General, Design and Development.
-
Bassel Tabbara [MSFT] #1
RE: ConfigurationSettings.AppSettings Error
Hello Chris,
When you are experiencing this problem? What are you including in the
AppSettings Config file.
Are you using long string? What characters are you using in this
configuration section?
Can you provide some sample when it will fail?
I am including below a Kb article that you might find useful:
311515 HOW TO: Store Data in Application Scope by Using ASP.NET and Visual
C#
[url]http://support.microsoft.com/?id=311515[/url]
Thanks,
Bassel Tabbara
Microsoft, ASP.NET
This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
| From: "Chris" <chris.bolyard@softvu.com>
| Subject: ConfigurationSettings.AppSettings Error
| Date: Wed, 2 Jul 2003 08:43:12 -0500
| Lines: 10
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| Message-ID: <OzjeR8JQDHA.3768@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: host46-162.discord.birch.net 65.16.46.162
| Path: cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
| Xref: cpmsftngxa09.phx.gbl microsoft.public.dotnet.framework.aspnet:31709
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Has anybody experience and/or resolved randomly getting NULL back from
| ConfigurationSettings.AppSettings?
| Framework 1.1
|
| We may need to setup a stress test to determine how often this occurs, but
| googling shows there are other cases.
|
| Thanks, Chris
|
|
|
Bassel Tabbara [MSFT] Guest
-
Web.Config and appSettings tag
I am storing a database connection string in a key/value pair in the appSettings tag of the web.config file as follows: <appSettings> <add... -
ConfigurationSettings Error
In my WebService I have a method called Download() that creates a dataset. To get my connection string which is located in my web.config file I call... -
How Do I get ConfigurationSettings from the calling assembly?
I'm developing a server control for our intranet. This control is only going to be used in two applications on the server, but they must be... -
How: Ampersand in AppSettings value??
I am wondering how i can put an ampersand character into the value attribute of a key in the appSettings section of my web.config file. If i try to... -
appSettings problem!
Hello! I have one problem with the appSettings on win2k srv machine with framework 1.1. Following line not work anymore (it worked fine with... -
Bassel Tabbara [MSFT] #2
Re: ConfigurationSettings.AppSettings Error
Hello Chris,
I am sorry that I couldn't get back to you earlier. I am including below a
code that doesn't return null values. Please let
me know if this works for you:
================
AppSettings.aspx
================
<%@ Page language="c#" Codebehind="AppSettings.aspx.cs"
AutoEventWireup="false" Inherits="CustomerDemos.AppSettings" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="AppSettings" method="post" runat="server">
<asp:Literal id="Literal1" runat="server"></asp:Literal>
</form>
</body>
</HTML>
==================
AppSettings.aspx.cs
==================
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Configuration;
using System.Collections.Specialized;
namespace CustomerDemos
{
/// <summary>
/// Summary description for AppSettings.
/// </summary>
public class AppSettings : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Literal Literal1;
private void Page_Load(object sender, System.EventArgs e)
{
NameValueCollection config = ConfigurationSettings.AppSettings;
foreach(String Key in config)
{
Literal1.Text += "Key: " + Key + "<br>";
Literal1.Text += "Value:" + config[Key] + "<p>";
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
==========
web.config
==========
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation
defaultLanguage="c#"
debug="true"
/>
<authentication mode="Windows" />
</system.web>
<appSettings>
<add key="CoreDBConnection" value="User ID=xx;Password=xxxx;Initial
Catalog=xxxx;Data Source=x.x.xx.xx" />
<add key="ListDBConnection" value="User ID=xx;Password=xxxx;Initial
Catalog=xxxx;Data Source=x.x.xx.x" />
<add key="RelayInboxQ" value=".\private$\xxbound" />
<add key="RelaySMTPQ" value=".\private$\yyybound" />
<add key="RelayWaitQ" value=".\private$\mmm" />
<add key="relay_xxx" value="Password=xxxx;User ID=xx;Initial
Catalog=relay_xxx;Data Source=x.x.xx.xx" />
</appSettings>
</configuration>
I hope this will work for you. This sample will print all the keys and the
values inside the appSettings. It
didn't find any null values.
Thanks,
Bassel Tabbara
Microsoft, ASP.NET
This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
| From: "Chris" <chris.bolyard@softvu.com>
| References: <OzjeR8JQDHA.3768@tk2msftngp13.phx.gbl>
<8l3WNxMQDHA.1724@cpmsftngxa09.phx.gbl>
| Subject: Re: ConfigurationSettings.AppSettings Error
| Date: Wed, 2 Jul 2003 15:24:29 -0500
| Lines: 93
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| Message-ID: <#2qSgcNQDHA.2424@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: host46-162.discord.birch.net 65.16.46.162
| Path: cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
| Xref: cpmsftngxa09.phx.gbl microsoft.public.dotnet.framework.aspnet:31840
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks for any help
|
| As mentioned below we have yet to stress test, but we only store sql
server
| connect strings and msmq paths (private queues for now)
|
| ConfigurationSettings.AppSettings["RelaySMTPQ"]
|
| <add key="RelaySMTPQ" value=".\private$\xxbound" />
|
|
|
| As mentioned below we have yet to stress test, but we only store sql
server
| connect strings and msmq paths (private queues for now)
|
|
| ConfigurationSettings.AppSettings["RelaySMTPQ"]
|
| <add key="RelaySMTPQ" value=".\private$\outboundmail" />
|
| Here is the entire section
|
| <add key="CoreDBConnection" value="User ID=xx;Password=xxxx;Initial
| Catalog=xxxx;Data Source=x.x.xx.xx" />
| <add key="ListDBConnection" value="User ID=xx;Password=xxxx;Initial
| Catalog=xxxx;Data Source=x.x.xx.x" />
| <add key="RelayInboxQ" value=".\private$\xxbound" />
| <add key="RelaySMTPQ" value=".\private$\yyybound" />
| <add key="RelayWaitQ" value=".\private$\mmm" />
| <add key="relay_xxx" value="Password=xxxx;User ID=xx;Initial
| Catalog=relay_xxx;Data Source=x.x.xx.xx" />
|
|
|
|
|
| ""Bassel Tabbara [MSFT]"" <basselt@online.microsoft.com> wrote in message
| news:8l3WNxMQDHA.1724@cpmsftngxa09.phx.gbl...
| > Hello Chris,
| >
| > When you are experiencing this problem? What are you including in the
| > AppSettings Config file.
| > Are you using long string? What characters are you using in this
| > configuration section?
| > Can you provide some sample when it will fail?
| >
| > I am including below a Kb article that you might find useful:
| >
| > 311515 HOW TO: Store Data in Application Scope by Using ASP.NET and
Visual
| > C#
| > [url]http://support.microsoft.com/?id=311515[/url]
| >
| >
| > Thanks,
| > Bassel Tabbara
| > Microsoft, ASP.NET
| >
| > This posting is provided "AS IS", with no warranties, and confers no
| rights.
| >
| >
| > --------------------
| > | From: "Chris" <chris.bolyard@softvu.com>
| > | Subject: ConfigurationSettings.AppSettings Error
| > | Date: Wed, 2 Jul 2003 08:43:12 -0500
| > | Lines: 10
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| > | Message-ID: <OzjeR8JQDHA.3768@tk2msftngp13.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: host46-162.discord.birch.net 65.16.46.162
| > | Path: cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
| > | Xref: cpmsftngxa09.phx.gbl
| microsoft.public.dotnet.framework.aspnet:31709
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Has anybody experience and/or resolved randomly getting NULL back from
| > | ConfigurationSettings.AppSettings?
| > | Framework 1.1
| > |
| > | We may need to setup a stress test to determine how often this occurs,
| but
| > | googling shows there are other cases.
| > |
| > | Thanks, Chris
| > |
| > |
| > |
| >
| >
|
|
|
Bassel Tabbara [MSFT] Guest



Reply With Quote

