473,659 Members | 2,987 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Web.Config for Legacy .ASP to get A Connection String

I have a mixed ASP.NET and legacy ASP application.

Right now, the .ASP pages use a mix of Hard Coded connection strings and an
"Global Included" file. I would like to use the connection string in the
Web.Config for all the Legacy .Asp pages.

Anyone know of a good way to do this? Here is a snip of my Web.Config (from
one system).

I thought about doing a simple text search on "DataConnection String" and
pulling the "Value", but I thought there may be a better way?

<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>
<appSettings>
<add key="dataconnec tstring" value="user id=ID;password= Pass;initial
catalog=cat;dat a source=source;p ooling='false'" />
Nov 21 '05 #1
1 1598
use the com based xml libray and an xpath to read it.

-- bruce (sqlwork.com)

"gregory_ma y" <None> wrote in message
news:OF******** ******@tk2msftn gp13.phx.gbl...
I have a mixed ASP.NET and legacy ASP application.

Right now, the .ASP pages use a mix of Hard Coded connection strings and
an "Global Included" file. I would like to use the connection string in
the Web.Config for all the Legacy .Asp pages.

Anyone know of a good way to do this? Here is a snip of my Web.Config
(from one system).

I thought about doing a simple text search on "DataConnection String" and
pulling the "Value", but I thought there may be a better way?

<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>
<appSettings>
<add key="dataconnec tstring" value="user id=ID;password= Pass;initial
catalog=cat;dat a source=source;p ooling='false'" />

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
38522
by: GrantS | last post by:
I am unable to get the connection to work with using the app.config file. the connection works when I use 'in line' connection as below: ------------------------------------------------------------------ I have a declaration in the class private OleDbConnection con; Then code in a procedure as below: 1. This works: con = new OleDbConnection
12
3460
by: Charlie | last post by:
Hi: My host will not allow me use a trusted connection or make registry setting, so I'm stuck trying find a way to hide connection string which will be stored in web.config file. If I encrypt string externally, can it be used in it's encrypted form to connect to SQL Server? If I decrypt back to string for use in connection string during runtime, I have to supply a key. If I do that, hacker could use key to break encryption. How do I...
12
3811
by: John M | last post by:
Hello, On Microsoft Visual Studio .NET 2003, I want to use some global elements, that can be used in each one of my pages. i.e I put a oleDBConnection on global.asax.vb How can I use it (the oleDBConnection on global.asa.vb) at the other aspx pages ?
13
3580
by: JIM.H. | last post by:
Hello, I have the following lines to read connection string from web.config; string cStr = ConfigurationSettings.AppSettings; SqlConnection sqlConn = new SqlConnection(cStr); this.sqlConnection1.ConnectionString = cStr; How can replace this with a DSN (ODBC connection) I defined in my current machine? Thanks,
12
4738
by: Ben | last post by:
I have a group of settings that I'd like to have inherited by multiple sites. I'm trying this, but it's not working. wwwroot\group\web.config wwwroot\group\site1\web.config wwwroot\group\site2\web.config Where site1 & site2 are applications.
2
9799
by: JoeSep | last post by:
Hi! Is it correct/safe to define a connection pool in the string "sqlConnectionString" of the "sessionState" section of Web.config? - The application is developed using AspNet 1.1 in a Windows Server 2003. - The AspState DB is defined in a Sql Server 2000 DB on another server. I have added this definition to the Web.config file: <sessionState mode="SQLServer"
10
2048
by: eagle | last post by:
I have a web.config in my application that contains the connection strings to all my datasources. I want to move these connection strings to another web config up the folder hierarchy so that all my apps can use the same connection strings. That is supposed to be how it's done, no? Instead of the web.config being in c:\inetpub\wwwroot\myApp\web.config, I have it in c:\inetpub\wwwroot\web.config. However, I get an "Object reference not...
2
5388
by: Johnson | last post by:
I'm trying to fix a "sub optimal" situation with respect to connection string management. Your thoughtful responses will be appreciated. I just started with a new client who has a bunch of legacy ASP.NET applications that all manage connection strings in Web.config the same way, like this: This client has one Web.config file per application, and that one Web.config file is duplicated across all environments (i.e., dev machines, test,...
12
77989
lifeisgreat20009
by: lifeisgreat20009 | last post by:
I am a newbie to Struts and JSP...I have been working on the code below for 5 hours now..I googled a lot but couldn't get much help so finally I am here.. Hoping of getting my problem solved. Please give me some idea where I am going wrong ?? I just want to retrieve data from my emp_mstr table and display it using my JSP file... The table emp_mstr is as follows :- CREATE TABLE EMP_MSTR( EMP_NO VARCHAR(10) PRIMARY KEY, PASSWORD...
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8335
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8528
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2752
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.