Configuration :: How To Modify Project Settings At Run Time
Aug 24, 2010
I have several settings in my project area (stored in web.config). However, the scope is not editable and is permanently set to "Application", which means I can't edit them at run time. I would really like to be able to edit these from the web interface. I know that doing so would restart the application (since the web.config was modified), but I'm okay with that, once the settings are written.
Is there any way to programmatically modify the settings in the <applicationSettings><PROJECT.Properties.Settings> area of the web.config?
View 9 Replies
Similar Messages:
Oct 1, 2010
My web application has hosted on the canada server but my all clients are indians.So, as I am using System.datetime.Now to store all the dates in application.Obviously, it is displaying the canadian time instead of india time.How can i do it?Is there not any gloabl settings that we can do in our web.config file so that it indicates to the server at run time which time zone to execute..?Or any other suitable alternate?
View 3 Replies
Apr 30, 2010
Web.config is the main settings and configuration file for an ASP.NET web application. The file is an XML document that defines configuration information regarding the web application. The web.config file contains information that control module loading, security configuration, session state configuration, and application language and compilation settings. Web.config files can also contain application specific items such as database connection strings
Example 1:
<!-- This is an example Web.config file -->
[Code]....
In this article, we will see how to read the configuration settings in the web.config using 'JavaScript'.
Step 1: Create a new ASP.NET website. Add a button control to the Default.aspx.
Step 2: Right click the project > Add New Item > Web Configuration File
Add the following sample entry to the appSettings section in the web.config between the <configuration> tag as shown in the example 1:
<add key="var1" value="SomeValue"/>
Step 3: To read these entries using JavaScript, add the following script in the <head> tag of your Default.aspx page as shown below:
<head runat="server">
<title></title>
<script type="text/javascript">
function ReadConfigSettings()
{
var v1 = '<%=ConfigurationManager.AppSettings["var1"].ToString() %>'
alert(v1);
}
</script>
</head>
Step 4: Call this function on a button click and display the values of the configuration settings
<input type="button" value="Get" onclick="ReadConfigSettings();" />
That's it. Run the application and click the button. The value of the key in the appSettings will be displayed in the alert window. I hope you liked this short article.
View 7 Replies
Dec 12, 2012
I published a project called TestSample which has 2 pages page1.aspx and page2.aspx and application dll Test.dll in bin folder.
what i need is, i want to create a new page called page3.aspx and page3.aspx.cs through programmatically which is done by file stream object, my need is to publish this page3.aspx to the TestSample virtual directory and also page3.aspx.cs has to be merged with Test.dll so that code behind should be avoided.
View 1 Replies
May 20, 2010
I'm working on an existing web project. All of the classes are in a seperate folder as vb files. I need to modify one to include a delete method. I think I can insert the delete method, my question is how do I update the project to include the modified class. I think that all of the classes are compiled into the project as a .dll which I don't know how to modify. I assume I need to modify the source vb file for the class and recompile?
View 5 Replies
Jan 14, 2010
How do you modify a ASP.NET MVC 2.0 project to work with the Spark View Engine?
I tried like described here:
[URL]
But somehow it still tries to route to .aspx files.
Here the code of my global.asax:
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(.......
View 5 Replies
Jul 22, 2010
I'm working on a new C# web application in Visual Studio 2010, and am having problems reading a value in Web.Debug.Config from the GLobal.asax.cs file.
In the Application_Start event I've got the following code:
Application.Add("AppID", ConfigurationManager.AppSettings.Get("AppID"));
I also tried:
Application.Add("AppID", ConfigurationManager.AppSettings["AppID"]);
And in the Web.Debug.Config file I have the following:
<applicationSettings>
<add key="AppID" value="123" />
</applicationSettings>
I also tried:
<appSettings>
<add key="AppID" value="123" />
</appSettings>
And I tried having it in a file path, like so:
<appSettings file="C:MyPathappSettings.config"/>
When running in debugger, I've got a break-point in the Application_Start event in Global.asax.cs. It hits the break point, but in all cases the value coming back from ConfigurationManager is coming back null. What am I doing wrong?
View 3 Replies
Feb 28, 2011
i have a project that is developed in asp.net 1.1. But i have vs 2010 installed...can i modify,debug and deploy from vs 2010.
View 1 Replies
Jan 11, 2010
I want to display time in textbox or in something like a numericupdownextender used in AJAX so that the user can change time as he desires..
i have used the control to show numbers and increase accordingly..
is there a way to do this..
new code but not what is desired...
<asp:TextBox runat="server" ID="txtHour"></asp:TextBox>
<ajaxToolkit:NumericUpDownExtender ID="txtHour_NumericUpDownExtender" runat="server" Enabled="True" Maximum="12" Minimum="1" TargetControlID="txtHour" Width="70"></ajaxToolkit:NumericUpDownExtender>
<asp:TextBox runat="server" ID="txtMinute"></asp:TextBox>
[Code]....
View 2 Replies
Jan 12, 2010
Our application has a database varchar field which at times store datetime values. Code is not formatting the date time values before storing.
Now the issue is coming when we are trying to restore database from our deployment server
to local server and then run the application.Dates are getting stored in format 'dd/mm/yyyy' [ex 31/12/2009] on deployment machine [EN-UK]however when we have restored DB and then try to run application on local server it throws invalid datetime exception, probably because it is expecting
datetime in 'mm/dd/yyyy' format [EN-US] (Dont know why !!).
The code base for our ASP.NET application is deployed into server machines with Regional and local settings as English-UK. However our local servers have regional settings as English-US we changed the regional settings from Control Panel to En-UK however still same error is coming !!
View 2 Replies
May 21, 2010
i would like to know how i could edit the time a user loggs out if inactive, as the default is quite short.
So for example, i would like to set the inactivity time before user is logged out, to 60 mins.
View 1 Replies
Mar 21, 2010
I have created 2 projects in a solution. One project contains Asp.net classes with login page and different other pages.
Another project contains a web service.
When I launch the solution(click F6 in visual studio 2008) the login page can access to the method of the webservice. Both projects are launched.
However when i added this 2 projects into IIS and deploy them (with create command) the login page cannot contact the method of the web service. Even though the web service is running because i can acces it manually. But they cannot communicate each other.
View 3 Replies
Feb 8, 2011
Right now, when I am copying the website to host server, I am changing the connection string in webconfig file and at each location of a sqldatasource or a query .. thats like more than 30 places where I am doing this.
When I am done copying the website, I have to change all the connection strings back to dev server for me to keep working on the dev copy....
View 1 Replies
Nov 15, 2010
I have application that fetches email configuration settings such as host (SMTP Server name), username (SMTP Username) and Password from App.Config File as shown below
<system.net>
<mailSettings>
<smtp from="name@example.com"><network host="smtp.gmail.com" userName="test123@gmail.com" port="25" password="PassworD"/>
</smtp>
</mailSettings>
</system.net>
Now i wish to configure the settings that i have set in database and NOT from App.Config File. From database the credentials are not available in SMTPClient's properties .FYI, they are saved in database as well as the values are also correct.
View 2 Replies
Mar 11, 2011
My question relates to the performance implications of reading application configuration data from an XML file.I am building an application that lists information from a database and needs to know how to display the lists, depending on the types of data returned.This is difficult to explain, but basically I would like to have an XML config file that lists the types and describes how to display them. This will allow me to change the display methods without re-compiling the application.
My question is really around performance. Given that my application will need to use this data many times during each page load...Should I be reading directly from the XML file and parse it each time I need it?
Or should I cache the XML object and parse it each time I need it?Or should I parse the XML once, generate some sort of object and cache that object?My guess is option 3, but I'm basically fishing for best practice around this.
View 1 Replies
Jan 15, 2010
I've written an NUnit test project against an ASP.Net project. The code being tested cannot find the configuration values (in Web.config) when invoked from my test project. What is the right way to provide these configuration settings so my tests will run?
View 2 Replies
Jun 6, 2010
I'm starting to consider creating a class library that I want to make generic so others can use it. While planning it out, I came to thinking about the various configuration settings that I would need. Since the idea is to make it open/shared, I wanted to make things as easy on the end user as possible. What's the best way to setup configuration settings without making use of web.config/app.config?
View 3 Replies
Sep 22, 2010
I am designing a web application for Leave Application of our faculties. There is a form in my website which represent the existing paper-back leave application form. Users(faculties) have to fill-up this web form and after validation an email will be send to the email address of our principal/hod. I hope that email address(s) will be provided to our group members. Now I want to know that what will be the required configuration of the web.config file? I found this blog ScottGu's Blog. Here the given configuration is:
[Code]....
But I think this is not acceptable for my project as the smtp from="test@foo.com", userName, password are unknown to me. So what should I do. Am I able to understand my requirement to you?
View 4 Replies
Apr 5, 2010
Sending eMail from my site is working fine in my local computer.
Before deploying the site to a hosting server, how should I change web.config mailsettings which is :
[code]....
View 4 Replies
Feb 15, 2010
What it best location to store various configuration settings of a web site modules. Creating class (that inherit ConfigurationSection) that map the settings in web.config file?Or creating some DAL and BLL clases that work with database?
View 5 Replies
Aug 10, 2010
I wish to keep the site settings like ProductsPerpage, SiteName, MaximumFileUploads etc in web.config file I wish to add a "Change Settings" form in the web site in order to change settings. Is it a standard method to access and edit the system.config file programmatically for changing site settings? Else what should be the good approach I should follow?
View 3 Replies
Nov 12, 2010
I've been thinking about this for a couple days but still would like some feedback on the best way to go about this:
I have multiple sites (domains) that will be running the same code. However, there are a couple settings I have in the appsettings web.config file which are relative to each site. (ie: defaultSiteTitle, emailFromAddress, etc).
I would like to deploy this application in only one location (folder) and point the domains in IIS to that one directory.
To do this, I believe I cannot use the web.config file to hold these settings...
So, I decided to make a SiteSettings.xml file and load the site settings in there:
<sites>
<oSite domain="abc.com" defaultSiteTitle="This is Site ABC" emailFromAddress="info@abc.com" />
<oSite domain="xyz.com" defaultSiteTitle="This is Site XYZ" emailFromAddress="info@xyz.com" />
</sites>
So when I need to access the site settings I just call a function in my datalayer that reads this xml file and via the httpRequest I pass it it determines which site settings to use.
Okay, that works when I call it from a page where I have the httpRequest...
Howver, now when I'm into some business layer functions say sendEmail and I need to find the emailFromAddress from the SiteSettings.xml file, I don't have the httpRequest. I know I could probably hack something together and pass it someway...
But I'm trying to figure out the best way to do this...
I don't really want to store it into session.
Is it possible to tell IIS what web.config file to look at, if I had multiple web.config files? (I don't think this is possible).
View 2 Replies
Mar 29, 2011
When my web application is running under Medium trust, I get an error when executing the method:
View 2 Replies
Jun 17, 2010
I have this portion of my web.config file;
[Code]....
I need to be able to retrieve the value of "from" in my application. How do I read this value into my code?
View 3 Replies
Dec 18, 2010
By defauly in my web.config I have set the , in runtime I just want to change the Mode = "Off" in memory. I do not want to save the changes to web.config.
Basically we need to see the description of the runtime error, when required.
View 2 Replies