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
    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:
         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. Advertising

  2. xarzu

    alvyrockz

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

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:
    402
    karim
    Jul 18, 2003
  2. bruce barker
    Replies:
    0
    Views:
    449
    bruce barker
    Jul 18, 2003
  3. E11
    Replies:
    1
    Views:
    4,785
    Thomas Weidenfeller
    Oct 12, 2005
  4. padma
    Replies:
    0
    Views:
    352
    padma
    Oct 3, 2007
  5. Metalone
    Replies:
    0
    Views:
    346
    Metalone
    Jan 6, 2010
Loading...

Share This Page