Connection Object Using Global.asa

i am making a site using asp. in this i am using mssql server2k as backend. i ve created a dsn. i want use global.asa file for creating connection object so that i don't ve to create con object in every .asp page. for that i ve write following code

<script language="vbscript" runat="server">
sub Application_onStart()

set con=server.createobject("adodb.connection")
con.open "dsn=pc;uid=sa;pwd=;database=dbname"

end sub
sub Application_onEnd()
set con=nothing

end sub
sub Session_onStart()

end sub
sub Session_onEnd()

end sub
</script>

now anyone tell me how to use that connection object in any asp file for fetching the recordset.

View Replies


ADVERTISEMENT

Global.asa Db Connection

I'm new to asp and I was told that I need a global.asa file in order to connect to a db (within our intranet).

okay, great fine...now I have an 'example' of a global.asa file. now, how do i go about connecting to a db from my asp page using this global.asa file?

View Replies View Related

Connection Info In Global.asa

Our ASP web application uses connection object from global.asa.
We hard coded Uid and pwd in global.asa.

Is there any way we can encrypt this Uid and Pwd in global.asa, or can
we access them through environment variables, if so can some one give me a
sample of code( to access environment variables through asp code.)

View Replies View Related

Connection String In Global.asa

I currently have my SQL Server connection string in an Application variable in the global.asa. Could that be a security risk? I have heard that with Cold Fusion, when there is a page error. the actual Connection String is written to the screen as part of the error page.

I'm quite sure that would not occur in ASP but just wanted to be sure, and get a few expert opinions.

View Replies View Related

Connection String In Global.asa

I was looking at another post, and what the person did was:

Dim strConn
strConn = "string"
application("strConn") = strConn
Now, am I able to create a connection object in my global.asa like so, and then keep my existing syntax for all my hundreds of queries?

Dim strCon
strCon = string
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open strCon
?

I'm trying to SAVE bandwidth, so I want to create my connection in global.asa instead of each time my include file 'top.asp' is executed. I can also close it easily...

PS. I believe Application_OnStart() is the best place to put it, am I correct?

View Replies View Related

Connection Strings -- Global.asa

1. Connection strings need to be in global.asa file always?
2. How can we encrypt the connection string userid and passwd in global.asa?

View Replies View Related

Remove Connection Information From The Global.asa File

I have actually an asp web site which use the global.asa file to connect to
the database but for security reason, I want to put username and password
information (or the complete connection string) in a seperate file so only a
special user could read these informations.

View Replies View Related

Passing Conf Object From Global.asa To A Dll

I am coding an application to make the portal send emails as needed. The
email formation and sending is taken care of in the dll, as is required.

Now i want to move the CDO.configuration object part to global.asa, so as to
ease to portability from stagin environment to production environment,
without need to modify source code.

I tried sending it as a parameter to a method of the dll, setting as a
session variable ( as my session object is being passed to the dll
successfully ), But nothing worked.

View Replies View Related

ADO Connection Object In Session_OnEnd

Why doesn't the following code work?

Sub Session_OnEnd
Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = Application("Connection_String")
Conn.Open 'here is the error
....
End Sub

A Conn object is created the same way in Session_OnStart and is used throughout the application, and Application("Connection_String") still exists here (I tested). So I suppose the error is caused by the fact that we are in Session_OnEnd.

View Replies View Related

Remove Connection From Applicaiton Object

The connection object is stored in a application object in a database.asp file which is included on all the pages. This is something that I didn't code but I am incharge of fixing it because we are having alot of problems with the IIS.

How do I remove the connection object from the application object? I am a bit confused, what if i just use a variable to set the connection and then still include the file on all the pages. Would that work? Code:

View Replies View Related

Application Object And Close Connection

Rather than opening and closing a new connection to the database on every page, I have placed that connection into an Application variable. This has worked fine so far.

My issue is that I have a logoff page where it closes that connection.But this means that users who are on the application will not be able to access that connection.The obvious answer is that I don't close the database connection.But my problem is, I would like to eventually close that database connection.

How can I determine if an application variable (not session variable) exists?How can I determine that there are not any users on the application?

View Replies View Related

Closed Or Invalid Connection Object Error...

I'm working on a quick wrapper so that I can connect to a database, run a quick query, get the needed info and pass it on to the next page that needs it. I've been programming for a long time but not with ASP/VBscript and think it's just something stupid that I've overlooked. Code:

View Replies View Related

Global.asa :: Assign Diffrent Global.asa To Each Application

I have one application folder containing all ASP code files. I want host multiple sites pointing to same code. Can I do this ? If YES then how I can assign diffrent global.asa to each application...

View Replies View Related

Global.asa :: Combine Many Global.asa Files

I have added a db driven marquee to my site and need to combine the global asa's to 1 global asa file. Code: ......

View Replies View Related

Connection Timeout For Adodb.connection

1.
conn.ConnectionTimeout = 60
conn.Open connString

2.
conn.Open connString
conn.ConnectionTimeout = 60

Do both of them give different?

View Replies View Related

Arrays Of Dictionary Object Stored In An Object?

I'll admit my ASP skills are very rusty, and come seeking help.

I'm currently using a dictionary object to store a multi-dimensional array.

I want to pass this dictionary object to an object, which holds an array of dictionary objects.

However I'm finding that the array is not getting set, thus I'm having great issue with dynamically resizing the object's property for every new dictionary object I'm adding.

View Replies View Related

Can VB Com Object Used By ASP Get Events Fired By An Internal Object?

I have a VC++ COM object which fires an event. I've written VB EXE apps against it and they receive the event notification.

I've now built a simple VB COM object which uses the VC++ COM object internally.

My question is, assuming the ASP page which loads the object does not immediately exit, will the VB COM object be able to receive the events from the internal object?

View Replies View Related

Object Reference Not Set To An Instance Of An Object.

We are using .net 1.1 on windows 2003 server. This is we are facing in our
production server.

When we are doing the load testing we are getting the bellow error. While
the load testing this error is not coming frequently. When we run 20 threads
for 3 mins we are getting this error message 2 or 3 times. But this line of
code is executed by all the threads. Code:

View Replies View Related

Recordset Object Vs Command Object

I want to open a recordset object on an .asp page. When I open the recordset I would like to use a stored procedure that expects a parameter to be passed for the stored procedure. I will then use the recordset to loop thru the recordset, update values from the recordset and then update the database by passing parmeters to another stored procedure.

I would like to use the recordset object but can it be used to pass a parameter to a stored procedure? Do I need to use a command object to open the records instead in
order to pass the parameter to a stored procedure?

View Replies View Related

DSN Connection Or Direct Connection

I wanted to know wheather DSN is ok for the connection to a database or direct conection is better?

when i started my web project on dreamweaver i had to make a DSN connection as i have followed the books, but as now as i have also asked several questions on this site, i have aslo implemented a direct connection as well on some pages, now i am wondering
is this going to have any affects when i uplode the complete site on the server.

i have noticed that on my computer when i am testing the site and uploading new records on sections that have DSN connections you can see the new record but on sections that i have implemented direct connection i cannot see it coz it is linked to the local directory database not on the testing server.

i have also never experienced uploading to a IIS server with DB connection so its my first time with dynamic websites. so am i in trouble or its ok the way i have done my site..

View Replies View Related

"Object Variable Not Set" When Object Is Neither Empty Nor Null?

I have a custom function for checking if a variable has been set or not to make the code easier to read, as well as to keep it shorter.

However, I'm getting errors that "Object Variable not Set", even after I've already checked for null and empty. Code:

View Replies View Related

"Object Reference Not Set To An Instance Of An Object"

A three-tier user authentication system was running without a problem for almost a year and now is suddenly dysfunctional. We don't know of any changes to any of the servers. It's quite maddening. The details:

1) We know the COM+ app is instanced on the COM+ server (Win 2000). The component graphic spins when CreateObject is called.

2) The proxy is installed on an IIS server (Win 2000) with delivers the interface, written in ASP, to the client PC.

3) These are the error messages displayed when a method of DAMS is called: Code:

View Replies View Related

Global Asa

I am trying to put a condition in my Global.asa file based on the server
name.the reason, I want to set a global string as a application variable based on
the server I am on.
I also need to set a coonection string based on the value of the server.
I need to use this connection string to retrieve values from an sp in
application on start that sets a load of global variables so I can't really
do this anywhere else.

View Replies View Related

Global Asa

I have a site which until this morning, was on a remote server. The structure was that the "site" was actually a folder on the server, as I am designer and use this arrangement to develop sites. Under the root directory, I had modified the global asa file to include session variables. Ok, so I download the site (folder) to my hard drive, and put it in the folder of "MY Documents" called MyWebs. I then opened VB Studio and created a new solution, which is pointing to the before mentioned directory in My Documents. When I pull the site up in IE, the session variables were not being called, and I realized I had not copied over the asa file. So I did so, placing a copy of it in the hard drive's c inetpub wwwroot directory, and also directly in the my docs mywebs directory,and the site's directory as well. It seems it is still not being called.Can anyone tell me what I am doing wrong?

View Replies View Related

Global.asa!

Is the Global.asa file resolved before parsing the 'Include' (files) or
after parsing the 'Include' (files)?

View Replies View Related

ASP, GLOBAL.ASA

I have IIS 5.0 installed on for a test server. the global.asa file runs perfectly.

when tryng the same application on win server 2003 IIS 6.0 the global.asa does not fire. i have set the application as a virtual site and given rights for iwam and iusr. What else could be the problem. Code:

View Replies View Related

GLOBAL.ASA And IIS 6.0

How does IIS 6.0 treat the global.asa file? I had the following problem;

1. uploaded a new site to the win3k server

2. had incorrect db connection string in Session_OnStart in global.asa and website caused errors.

3. Changed the global.asa file to include the correct details. Saved the file. Still got the same errors.

I could not resolve this unless restarting the WWW Service on this server. In IIS 5.0 the global.asa file would reload after resaving it (as the timestamp is updated).

I even waited the next day before restarting the service because I though Session_OnStart expires after my session ends...but the error was still there
in the morning.

Hopefully someone will make sense of it for me. Here is the code (I inherited) in the global.asa

Sub Application_OnStart
Application("DB.ConnectionString")= ""
Application("MaxLoginAttempts") = 5
Set Application("Con") = Server.CreateObject("ADODB.Connection")
Session("Test") = Now()
End Sub

Sub Session_OnStart....

View Replies View Related

ADO In Global.asa

Is it possible to use ADO in global.asa?I simply want to creat a log of each visit to the site?

View Replies View Related

COM And Global.asa

I created a dll to track our users and I want to call it in the Global.asa. How do I do this? I've seen the <OBJECT> tag to create an object, but I'm not sure how to use it correctly.

View Replies View Related

Global.ASA Reg.

I dont have any idea about Global.asa. Is it for global variable declarations?

View Replies View Related

How To Use Global.asa

i'm a little bit confused with using application_onstart.. as u can see in the following code... my DB connection and SQL statements is currently included in my application_onstart event.. but, unfortunately, i wasn't able to reference Application("sUser") in my asp when i tried to run my website Code:

View Replies View Related

Global Changes To SQL

We have over 100 asp pages that reference a table (distribution_components). We added a new column and primary key to that table, so now we have to modify the where clause to include that column (we have to make the new column = to a session variable in the page)

The table appears 531 times in our code. Is there some util or method that allows us to change it globally, other than going to each occurrance, and adding the new column to the where clause.

View Replies View Related

Global Session_Onend

Basically session_onend will not fire in my global.asa files! I have just made a very simple test to prove its not my programming and it still doesnt fire.
Session_onstart works a treat but onend will not work even if you force the session to expire with abandon. I have tried on 2 of our servers now and it doesnt work on either.

my simple test is this:

Sub Session_OnEnd
application("test") = "hello"
End Sub

Now surely that should work. i obviously have a page that writes that test variable to the page but its always empty.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved