What is the Congiguration manager class in asp.net / c#?

Discussion in 'ASP .Net Web Services' started by xarzu, Apr 5, 2013.

  1. xarzu

    xarzu

    Joined:
    Apr 3, 2007
    Messages:
    8
    Likes Received:
    0
    What is the Congiguration manager class in the code and how to you set it in the Project or IDE?

    How do I set AppSettings in an ASPX project's Configuration manager?

    This is an ASPX/CS Project with Visual Studio 2010. It is a Configuration Manager question.

    I am successfully debugging (sort of) some code that is being used already on a server. But there is a piece of code that plays with the URL in the live version that should not be used in the debug/localhost version.

    Code (Text):
         protected void Page_Load(object sender, EventArgs e)
            {
                if (ConfigurationManager.AppSettings["IsTesting"] == "false" && Request.Url.ToString().Contains("http:"))
                {
                    Response.Redirect(Request.Url.ToString().Replace("http:", "https:"));
                }

                LoadMasterTemplate();
            }
    This piece of code lands on the "Response.Redirect...." line when it should not because the "IsTesting" app setting should be set to true in the ConfigurationManager . How do I set that?
     
    xarzu, Apr 5, 2013
    #1
    1. Advertisements

  2. xarzu

    alvyrockz

    Joined:
    Sep 23, 2013
    Messages:
    4
    Likes Received:
    0
    You should set a value in appsetting inside web.config like
    <add key="IsTesting" value="false">
     
    alvyrockz, Sep 23, 2013
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mamcx
    Replies:
    1
    Views:
    518
    karim
    Jul 18, 2003
  2. rooster575
    Replies:
    0
    Views:
    1,993
    rooster575
    Jun 5, 2004
  3. John
    Replies:
    0
    Views:
    507
  4. E11
    Replies:
    1
    Views:
    5,665
    Thomas Weidenfeller
    Oct 12, 2005
  5. christopher diggins
    Replies:
    16
    Views:
    1,019
    Pete Becker
    May 4, 2005
  6. Joseph Turian
    Replies:
    5
    Views:
    843
  7. padma
    Replies:
    0
    Views:
    561
    padma
    Oct 3, 2007
  8. Metalone
    Replies:
    0
    Views:
    534
    Metalone
    Jan 6, 2010
Loading...