Results 1 to 3 of 3

Thread: [RESOLVED] Web.config > adding a support email for the entire site.

  1. #1

    Thread Starter
    Hyperactive Member gjon's Avatar
    Join Date
    Nov 2004
    Location
    Inescapable Void
    Posts
    442

    Resolved [RESOLVED] Web.config > adding a support email for the entire site.

    The book mentions adding the line:
    <appSettings>
    <add key="SupportEmail" value="[email protected]" />
    </appSettings>

    into the web.config file like so, or so I believe:

    <?xml version="1.0"?>
    <!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
    -->
    <configuration>
    <appSettings>
    <add key="SupportEmail" value="[email protected]" />
    </appSettings>
    <connectionStrings/>
    <system.web>
    <!--
    Set compilation debug="true" to insert debugging
    symbols into the compiled page. Because this
    affects performance, set this value to true only
    during development.
    -->
    <compilation debug="false" />
    <!--
    The <authentication> section enables configuration
    of the security authentication mode used by
    ASP.NET to identify an incoming user.
    -->
    <authentication mode="Windows" />
    <!--
    The <customErrors> section enables configuration
    of what to do if/when an unhandled error occurs
    during the execution of a request. Specifically,
    it enables developers to configure html error pages
    to be displayed in place of a error stack trace.

    <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
    <error statusCode="403" redirect="NoAccess.htm" />
    <error statusCode="404" redirect="FileNotFound.htm" />
    </customErrors>
    -->

    </system.web>
    </configuration>

    Now, how would you take advantage of that in your web site's pages?
    What is the point and how do you make use of it?
    Thanks in advance.
    Last edited by gjon; Mar 25th, 2007 at 10:58 PM.

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: Web.config > adding a support email for the entire site.

    It means that from anywhere in your application you have access to that email address, so that if it changes at any point in the future all you have to do is make the change to the web.config and not recompile/upload your app.

    It can be accessed something like this:
    Code:
    ConfigurationSettings.AppSettings("SupportEmail");

  3. #3

    Thread Starter
    Hyperactive Member gjon's Avatar
    Join Date
    Nov 2004
    Location
    Inescapable Void
    Posts
    442

    Re: Web.config > adding a support email for the entire site.

    Thank you for the example.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width