473,320 Members | 1,948 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 1752

"Dave" <da*******@newsgroup.nospamwrote in message
news:OB**************@TK2MSFTNGP02.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_OnStart
Application("connStr") = "Provider=<provider>;Data Source=<datasource>"
End Sub

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

Thanks

"Mike Brind" <pa*******@hotmail.comwrote in message
news:eB**************@TK2MSFTNGP03.phx.gbl...
>
"Dave" <da*******@newsgroup.nospamwrote in message
news:OB**************@TK2MSFTNGP02.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_OnStart
Application("connStr") = "Provider=<provider>;Data Source=<datasource>"
End Sub

--
Mike Brind

Oct 22 '06 #3
Hello Dave,

Another option is create a lightweight COM component and use it to return
connectionstring, this can help hidden the connectionstring 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
connectionstring. e.g.

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

<%
dim obj
dim connstr

obj = Server.CreateObject("mycomponent")
connstr = obj.GetConnectionString()
%>

==========

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
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...
2
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...
2
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...
9
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...
3
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...
2
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...
0
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: ...
0
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...
12
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....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.