app-config

Binding ASP.Net Web.Config Settings To .ASPX File <a href></a>?

纵然是瞬间 提交于 2019-11-29 07:46:19
The Scenario I have an ASP.NET web project. I want to be able to define all of the links for the site inside my web.config file so that they can be changed easily if needs be. Currently I have an "" section in my web.config file. The Question How do I bind this key value pair to an '' tag in my .aspx file?! The App Settings in My Web.Config File <appSettings> <add key="MyNewLink" value="http://someurl.co.uk/" /> </appSettings> Help greatly appreciated. EDIT: Sorry I should have mentioned that this is for a html link: **<a href></a>** Locksfree In your aspx file it would be: NavigateUrl='<%$

Can I use / access the app.config from .net code, when called via COM

我与影子孤独终老i 提交于 2019-11-29 06:59:39
I have an existing set of .net libraries that I wish to call from Excel VBA (that part is working fine). These libraries rely on settings in the app.config. I know I can enter these settings in a excel.exe.config file (placed in the same directory as the excel.exe), but this doesn't really seem like a very manageable solution to me, as I can see causing conflicts if more than one application wants to do this. My question is simple: is there any way of COM exposed dlls referring to their respective config files? Sample app.config: <?xml version="1.0" encoding="utf-8" ?> <configuration>

.net 3.5: To read connectionstring from app.config?

谁说胖子不能爱 提交于 2019-11-29 06:34:26
How to read connection string info from app.config file using .net api? Platform is .net 3.5 <?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add connectionString="" providerName="" name=""/> </connectionStrings> </configuration> Please see Reading Connection Strings in Web.Config and App.Config and Enterprise Library DAAB Settings (on the Wayback Machine as the original got deleted) ConnectionStringSettings connection = ConfigurationManager.ConnectionStrings["MyConnectionString"] string connectionString = connection.ConnectionString You may need to add an assembly

TransactionScope maximumTimeout

浪尽此生 提交于 2019-11-29 06:30:17
问题 I use TransactionScope in this code: private void ExecuteSP() { bool IsComplete = false; SqlCommand sqlComm = null; //6 hours!!! TimeSpan ts1 = new TimeSpan(6, 0, 0); try { using (TransactionScope t = new TransactionScope(TransactionScopeOption.RequiresNew, ts1)) { using (SqlConnection sqlConn = new SqlConnection(GetConnectionString())) { //open sql connection sqlConn.Open(); try { //create new sqlCommand sqlComm = new SqlCommand(); for (int i = 1; i <= 2; i++) { IsComplete = true; //This

Reload app.config with nunit

点点圈 提交于 2019-11-29 06:20:58
I have multiple NUnit tests, and I would like each test to use a specific app.config file. Is there a way to reset the configuration to a new config file before each test? Try: /* Usage * using(AppConfig.Change("my.config")) { * // do something... * } */ public abstract class AppConfig : IDisposable { public static AppConfig Change(string path) { return new ChangeAppConfig(path); } public abstract void Dispose(); private class ChangeAppConfig : AppConfig { private bool disposedValue = false; private string oldConfig = Conversions.ToString(AppDomain.CurrentDomain.GetData("APP_CONFIG_FILE"));

Get the file path of current application's config file

独自空忆成欢 提交于 2019-11-29 06:12:30
问题 The reason I asked this question is that I wanted to create a helper class for Remoting instantiation, and wanted to pass the appropriate app.exe.config (or web.config) file path to the RemotingConfiguration.Configure method, depending on the caller. Is there a way I could get the name of the config file for both Win and Web apps without checking if the application is Web or WinForms? 回答1: I've used string folder = System.Web.HttpContext.Current != null ? System.IO.Path.Combine(AppDomain

Multiple SQL Server connection strings in app.config file

自作多情 提交于 2019-11-29 06:10:51
I'm interested in displaying in a Windows Forms app a list of N radio buttons for the user to choose a target database server. I would like to add the SQL Server connection strings in the app.config file, so they are read by the app at runtime and rendered in the windows form as radio buttons. At first I thought of using a delimiter to separate the connections <appSettings> <add key="ConnectionString" value="connection1|user id=user;password=123;server=10.0.0.1;database=myDatabase;connection timeout=30|connection2|user id=user;password=123;server=10.0.0.2;database=myDatabase;connection timeout

When storing a MySQL connection string in App.config, what value should the providerName property be set to?

孤人 提交于 2019-11-29 04:19:14
When storing a MySQL connection string in App.config, what value should the providerName property be set to? For example in the below App.config file, what value should I use for the providerName? Does it matter? <?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="MySQL" connectionString="SERVER=8.8.8.8; DATABASE=foo; UID=bar; PASSWORD=foobar" providerName="WhatGoesHere?" /> </connectionStrings> </configuration> Try this: <connectionStrings> <add name="MySQL" connectionString="SERVER=8.8.8.8; DATABASE=foo; UID=bar; PASSWORD=foobar" providerName="MySql.Data

Using Windows Role authentication in the App.config with WCF

試著忘記壹切 提交于 2019-11-29 03:24:24
问题 I am using a WCF service and a net.tcp endpoint with serviceAuthentication's principal PermissionMode set to UseWindowsGroups. Currently in the implementation of the service i am using the PrincipalPermission attribute to set the role requirements for each method. [PrincipalPermission(SecurityAction.Demand, Role = "Administrators")] [OperationBehavior(Impersonation = ImpersonationOption.Required)] public string method1() I am trying to do pretty much the same exact thing, except have the

app.config configSections custom settings can not find schema information

泪湿孤枕 提交于 2019-11-29 03:23:05
I am just learning about app.config in respect of creating custom sections. I have that part working, it compiles and gets the information out as required but I get warnings about it could not find the schema information. I have done a bit of googling and could not find a simple explanation of this situation. The approach (that seems to make sense to me at the moment) would be to have a schema file for each section within that project. I understand how to create a schema file, but do not know how I would like this into the project. Also when it is compiled and deployed to another machine I