Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Services (http://www.velocityreviews.com/forums/f64-asp-net-web-services.html)
-   -   What is the Congiguration manager class in asp.net / c#? (http://www.velocityreviews.com/forums/t959420-what-is-the-congiguration-manager-class-in-asp-net-c.html)

xarzu 04-05-2013 02:04 AM

What is the Congiguration manager class in asp.net / c#?
 
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?

alvyrockz 09-23-2013 11:41 AM

You should set a value in appsetting inside web.config like
<add key="IsTesting" value="false">


All times are GMT. The time now is 07:07 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.