473,698 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I reference an include page from global.asa?

I have different database connections that I use for DEV and PROD versions
of our web app.

I want to put the database connection string in one location so I only have
to change it once when we push live.

So I put it in an include file and reference it in all my asp pages as:
<!--#include file="includes/db_conn.inc"-->

But this will not work with the global.asa page.

How can I reference an include page from global.asa?
Oct 21 '06 #1
3 1760

"Dave" <da*******@news group.nospamwro te in message
news:OB******** ******@TK2MSFTN GP02.phx.gbl...
I have different database connections that I use for DEV and PROD versions
of our web app.

I want to put the database connection string in one location so I only
have to change it once when we push live.

So I put it in an include file and reference it in all my asp pages as:
<!--#include file="includes/db_conn.inc"-->

But this will not work with the global.asa page.

How can I reference an include page from global.asa?

Don't store the connection string in an include. Store it in the global.asa
as an appplication variable:

Sub Application_OnS tart
Application("co nnStr") = "Provider=<prov ider>;Data Source=<datasou rce>"
End Sub

--
Mike Brind
Oct 21 '06 #2
Yes. That works much better.

Thanks

"Mike Brind" <pa*******@hotm ail.comwrote in message
news:eB******** ******@TK2MSFTN GP03.phx.gbl...
>
"Dave" <da*******@news group.nospamwro te in message
news:OB******** ******@TK2MSFTN GP02.phx.gbl...
>I have different database connections that I use for DEV and PROD
versions of our web app.

I want to put the database connection string in one location so I only
have to change it once when we push live.

So I put it in an include file and reference it in all my asp pages as:
<!--#include file="includes/db_conn.inc"-->

But this will not work with the global.asa page.

How can I reference an include page from global.asa?


Don't store the connection string in an include. Store it in the
global.asa as an appplication variable:

Sub Application_OnS tart
Application("co nnStr") = "Provider=<prov ider>;Data Source=<datasou rce>"
End Sub

--
Mike Brind

Oct 22 '06 #3
Hello Dave,

Another option is create a lightweight COM component and use it to return
connectionstrin g, this can help hidden the connectionstrin g in COM object
instead of put the clear text in global.asa or other page file. You can use
VB to create a activex component conveniently. And in your page or
global.asa you just need to create the COM object and query for
connectionstrin g. e.g.

=============

<%
dim obj
dim connstr

obj = Server.CreateOb ject("mycompone nt")
connstr = obj.GetConnecti onString()
%>

==========

Hope also helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 23 '06 #4

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

Similar topics

3
11832
by: blueblueblue2005 | last post by:
Hi, I am learning C++ using the examples from Deitel How to Program in C++. I download the example code. now I am working on the operator overloading. I am working under Ubuntu Linux 5.04. I installed the g++ compiler package from synaptic package manager, g++-3.3, and set up a soft link g++. when I compile the sample code( the command I use is: g++ fig11_05.cpp), I got error message like this: /tmp/ccJDZHAY.o(.text+0x4f): In function...
2
1633
by: learner | last post by:
Hi, In a page, i have many links. I have some functions in a global file which is included in all linked pages. I want to have a reference to a window which is to be opened on clicking one link and it should be known only to one more link on that page and not to other links. I cant have that window reference in that global file, since iam declaring it initially as Null and modifying its value in that one particular link. Since all links...
2
1169
by: Bill Cart | last post by:
I am very new at this C# stuff. I keep trying to understand it but I don't seen to have a clue. I am trying to fill a DropDownList from a data adapter. I have a web application. In the Global.asx I have private System.Data.SqlClient.SqlConnection sqlConSWT; private System.Data.SqlClient.SqlCommand sqlCmdAddDemoReq; private System.Data.SqlClient.SqlDataAdapter sqlDaStates; private System.Data.SqlClient.SqlCommand sqlSelectCommand1;...
9
2173
by: Moe Sizlak | last post by:
Hi There, I am trying to write the selected value of a listcontrol when a button is clicked and I keep getting the error "object not set to a reference of an object". The libox itself is in a usercontrol and all i'm really needing to do is get the selected value when the button is clicked on the form. Can someone tell what I need to include in my page to get this working ? Moe <><
3
3944
by: Pierre | last post by:
Hello, In an aspx page (mypage.aspx) from a web projet, I would like to get the value of a variable of the projet that is declared as public in a module. The variable can be called from anywhere in the code behind page and in the class files, but when I try to call it from an aspx page, it raises an error. <%=myvar%> in mypage.aspx raise an error : the name "myvar" is not declared.
2
3051
by: Jake Barnes | last post by:
Using javascript closures to create singletons to ensure the survival of a reference to an HTML block when removeChild() may remove the last reference to the block and thus destory the block is what I'm hoping to achieve. I've never before had to use Javascript closures, but now I do, so I'm making an effort to understand them. I've been giving this essay a re-read: http://jibbering.com/faq/faq_notes/closures.html
0
2107
by: Abhishek Padmanabh | last post by:
I have been trying out boost's serialization library for the past few days. And I have come across a problem serializing a class that has a reference member. The code is posted as below: #include <iostream> #include <fstream> #include <string> #include <boost/archive/xml_iarchive.hpp>
0
1106
markrawlingson
by: markrawlingson | last post by:
Hello, So I've got a list of functions written in ASP Classic which I include into every page within my application(s). This file is getting quite big and in most scenarios needs to be called 4-5 times for each page load because of the way I structure my pages (sitehead.asp,sitefoot.asp,sidemain.asp, etc). Thus, i'm trying to compile them as a COM/DLL object and simply create an instance of the object in the global.asa and reference the...
12
3011
by: Bryan Parkoff | last post by:
I write my large project in C++ source code. My C++ source code contains approximate four thousand small functions. Most of them are inline. I define variables and functions in the global scope. The global variables and global functions are hidden to prevent from accessing by the programmers. All global functions share global variables. Only very few global functions are allowed to be reusability for the programmers to use. Few...
0
8672
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
8600
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
9155
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...
0
9018
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8858
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
7711
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2322
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.