web.config and app.config in VS2005

Hi there

I'm new to web programming. I'm using asp.net 2.0(vb.net) in Visual Studio 2005.

When writing windows applications I use app.config to store string constants. I simply Right click on my project name in Solution Explorer and choose properties. Then I click Settings and type in the name of the constant, type = string, scope = application, the value and I could retrieve it in any form or class of the project using My.Settings.sConstant.

How can I do that in web applications using web.config?

thanks 

 

 

0
koure
2/26/2007 5:49:50 PM
asp.net.vs2005-webapp-projects 1239 articles. 0 followers. Follow

3 Replies
709 Views

Similar Articles

[PageSpeed] 45
Get it on Google Play
Get it on Apple App Store

Add the following, of course with your own constants:

undefinedappSettingsundefined
undefinedadd key="SourceDir" value="\\whatever"undefined
undefinedadd key="SirSourceDir" value="\\whatever2undefined
undefinedappSettingsundefined

 Then to get the values from the asp page use the following assuming you have a label1 in your file:

Label1.Text = ConfigurationManager.AppSettings.Item(

"SourceDir").ToString

 

Hope this helps...

Dapanther99

 

 

0
dapanther99
2/26/2007 7:01:59 PM

Sorry, had the wrong formatting set, should be this

 

<appSettings>
<add key="SourceDir" value="\\whatever"/>
<add key="SirSourceDir" value="\\whatever2"/>
</appSettings>

0
dapanther99
2/26/2007 7:04:02 PM

Thanks very much

It helped me

Thanks again 

0
koure
2/26/2007 7:09:35 PM
Reply:

Similar Artilces:

web.config overrides settings in app.config? VS2005
Hi,I have a scenario which I thought would be more common but can't find much information online about it so any pointers will be appreciated. I have a class library with various classes and a DAL in which I am using the dataset designer to expose data access. It in turn the dataset designer is creating it's connection strings happily and adding them to the app.config file. However, I am using a web deployment project to deploy the web project and change the connection strings in the web.config file. I was lead to believe that so long as i named the connection string in the web....

How to specify custon HTTPHandlers in web.config in VS2005 web app?
Hi,Please guide me out of this issue:Here, I have got a web application project using VS 2005, wherein I want to point all my .aspx requests to a particular httphandler, all the plumbing in implementing a class extended from IHTTPHandler being in the same assembly, I have got stuck in the web.config wherein I have to map the request type with the handler something like this:<add verb="*" path="*.aspx" type="abc.xyx.MyHttpHandler,WebDashboard"/>The problem here is that at runtime the assembly is not being located, and hence a vanilla screen each time I run the app, with the foll...

How do I merge web services' app.config with web app's web.config? Help!!
I have a web application project that uses a separate class library containing web service references (service layer). I want to be able to configure the web reference URLs dynamically and I know you can set this up by setting the URL behavior to  'Dynamic', etc, etc. The problem is VS2005 puts the URLs in the project's app.config file. When the class library becomes a DLL component, I have no way of accessing the app.config file.Is there a way to make the web reference project to look for the URLs in the web.config instead of its app.config? Or is there a way to merge this app.config w...

Need to put this in a web.config file. Transfer a collection from app.config to web.config.
<!--<setting name="Groups" serializeAs="Xml"> <value> <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <string>GL CA Corporate Data</string> <string>GL CONT Contractors</string> <string>GL IT SolutionDelivery</string> </ArrayOfString> </value> </setting>-->   I need to put this in the below web.config.<?xml version="1.0"?><!-- Note: As an alternative to hand editing this fi...

Read info from web.config, machine.config, app.config....
I know how to read info from the web.config, see code:  Protected path As String = "/Framework" Protected config As Configuration = WebConfigurationManager.OpenWebConfiguration(path) How can I read also the data from machine.config and other config files, like the app.configs?Johan TheunissenMCPD, MCSE, MCTS BizTalk 2006==============================Please mark the most helpful reply/replies as "Answer". ...

Separate DAL project with DataSet: the connstring is in app.config, not web.config
I have a separate project (DAL) with a Typed DataSet, I just started laying out my Solution. I need to reuse the code in different projects. However, as soon as I started designing the DataSet, Visual Studio generated a file called app.config and a file called settings.settings under properties.I am just wondering how this will work out in a web application, because that should work with a file called web.config, right? Is this going to work, and will I need to jump through hoops to get it to work?Thanks!When you ask a question, remember to click "mark as answered" when you get a reply which...

App.config/web.config
Hello!! I'm development a web application in n-tiers. The UI have a web.config, and the other tiers using app.config. The problem is that the application doesn´t recognize the app.config files. Only the web.config of the UI. For example: I try to put the connections string in a app.config in the data access, but when it runing, throws a error that says: "Database undefined". But when I put the connections strings in the web.config, it runing well. I need help!!!Alvaro HdezDeveloper To use xml atributes from WebConfig and AppConfig u must add referance to System...

.NET 2.0 encryption web.config/app.config options?
Situation: 13 servers containing both ASP .Net web sites and .NET apps. Servers are broken up in Developemnt, Test, and Production types.Issue: Need to encrypt all app.config and web.config files.Currently we are using .NET 1.1, so I had developed (test working, not yet deployed) a shared (GAC) utility that would be responsible for providing an interface to allow the encryption (DPAPI + Second Entropy) of information for the developer to manually place in each web.conf/app.config file during development. The backend of this utility was referenced by the *.config files in decrypting values on...

App.Config/Web.Config
I have setup custom config sections. I need to know how to loop through a configuration group and get all of the config sections in that group. Thanks could you post an example of what you have Trey Exactly, your question is not clear at all. Regards.Bilal Hadiar, MCP, MCTS, MCPD, MCTMicrosoft MVP - Telerik MVP...

App.config to Web.config
I have been running a console app, to process a paypal payment.  The code gets a value from the app.config file. <add key="PAYFLOW_HOST" value="payflowpro.paypal.com" /> However I have now incorporate the code into a web application and put the key into my web.config file, will the code now know to look for this key in this place? If your code is getting the value from your config file using ConfigurationManager.AppSettings["PAYFLOW_HOST"] then it should use the correct config file automatically.  Console apps, windows services and wind...

VS2005 Web Setup Project
Trying to create setup.exe and setup.msi with a web setup project.  Everything is working fine, except I can't figure out how to include a production "app.config" file vs. the development "app.config" file. In other words, I want to exclude " /app.config" but want to include "/prod/app.config", but I want "/prod/app.config" to show up on the web application root directory. I'd like to not have to utilize a web deployment project just to accomplish this one exception. Thanks for any suggestions...   OK,...

vs2005 web application with vs2005 web deployment project build failed
We Migrated our faily large ASP.NET project (has several folder hierarchy and our aspx pages refers to usercontrols in parent folders) to a VS2005 Web Application (not web site) project.Migration went well. We can build and run the project successfully.But when we comes to deploy vs 2005 web application project we did not find publish web site option unfortunately.So we added a Web deployment project to our web application project. But we could not complie the web deployment projecteven though we can complie out web application project. We encounter the following error in all of our ascx pag...

Is it possible to migrate VS2005 Web Application Project to VS2005 Web Site.
Good afternoon.On my first project using VS2005, it was a brand new project so we didn't have to face the migration issue.  As we were developing right after VS2005 was released, we created the code using File | New | Web Site.I have now moved onto my second project and this one is a migration from a previously existing .NET 1.1 codebase to .NET 2.0.   We are currently investigating the best approach for migrating this code from VS2003 to VS2005.  We are thinking that at least initially, we might convert the code into a VS2005 Web Application Project using the steps located at...

Web Deployment Project - Config Properties
I'm using a Web Deployment Project to compile my web site. In the Property Pages - Configuration Properties - Deployment section, there is an option to 'Enable Web.config file section replacement'. I have this working to replace certain sections of my web.config for each build config (release/staging/dev). I think this makes sense so other developers do not have to remember to change the web.config file. HOWEVER, this only seems to work when replacing parts of web.config; such as appSettings, connectionString, etc. This would require me to have separate config files for each section and bui...

Web resources about - web.config and app.config in VS2005 - asp.net.vs2005-webapp-projects

Proxy auto-config - Wikipedia, the free encyclopedia
Computer operating systems (e.g., Microsoft Windows , Mac OS X , Linux ) require a number of settings to communicate over the Internet . These ...

Platform Updates: New Industry Pages, Refreshed Services Status Page, and New Parse Config Dashboard
Platform Updates: New Industry Pages, Refreshed Services Status Page, and New Parse Config Dashboard

App Config for Android - YouTube
Free version: https://play.google.com/store/apps/details?id=fi.aarosoft.appconfig.free Full version: https://play.google.com/store/apps/deta ...

HP unveils cloud config manager
HP this week unveiled a network virtualization system for large enterprise and cloud providers designed to simplify network configuration.

China configs 'firewall' against official meddling in judicial cases
China configs 'firewall' against official meddling in judicial cases

Group criticizes Apple’s removal of IPv6 in Airport config tool
Back in January of this year Apple released AirPort Utility 6.0 , an updated version of the configuration tool for setting up home networks and ...

System Software: Configs for Mac 128K, XL, 512, & 512KE (7/94)
Macintosh 128K Currently ships with: Product no longer available. Supports: System 2.0 and Finder 4.1. Recommended: System 2.0 and Finder 4.1. ...

Free 32GB Apple TV and $60-$111 discounts on iMac 4Ks & iMac 5Ks, plus $150 coupons on all custom configs ...
Whether you want a free Apple TV plus discounts, a free AppleCare extended protection plan plus discounts, or just the lowest prices anywhere ...

Dell releases updated XPS-13 Developer Edition in wide variety of configs
... is available immediately in North America and Europe. According to Dell’s announcement blog post , there is a wide variety of possible configurations ...

Config error at Boston-area hosting company takes down Reddit, others
... hosting provider briefly knocked several large services and websites dependent on Amazon and AWS offline on Tuesday night, thanks to a configuration ...

Resources last updated: 1/9/2016 1:14:17 PM