472,325 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,325 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 1717

"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...
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...
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...
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...
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...
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...
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...
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...
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...
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.